Have a Question?
Print

What It Means That Java 8 Drops Support for ODBC Connections From Java (and thus BBj)

In Java 1.8, Oracle removed the JDBC-ODBC Bridge Driver from the Windows JVM installation. This driver was used to provide access to ODBC data sources from Java applications. With this change, BBj can no longer access ODBC data sources from BBj programs unless you install one of the third party commercial ODBC bridge options available. The most common users affected by this change will be those who access Microsoft Access databases from BBj. If you are currently using ODBC data sources to access a third party DBMS from BBj, BASIS recommends switching to a JDBC driver for the DBMS, or using one of the commercial ODBC bridge options available.  NOTE: This has no impact whatsoever on ODBC applications accessing BBj databases.  ODBC applications accessing BBj databases is a completely different technology.

What about MS Access, is there a JDBC driver available?
The open source community has developed a solid MS Access, pure Java implementation that is a free open source (LGPL) JDBC driver.  In fact, this is now built into BBj so it is immediately available in BBj 15.00 and higher.  The beauty of this is that it is also platform independent so BBj applications now have the ability to access MS Access files from any platform, not only Windows.  Please see the following link for complete details and sample code: Accessing Third Party Databases  
How will my BBj application be affected if I’m currently using ODBC to connect to a third party DBMS from BBj?
The only code change necessary is to the connection string.  Everything else remains identical.  If the sql.ini file contains an alias for the connection string or if the application stores connection information in some kind of configuration file, there may be no code changes necessary to switch from using the ODBC driver to the all-Java JDBC driver for a particular database.
To switch from using an ODBC driver to using a JDBC driver, first download and install the appropriate JDBC driver for your 3rd party database in a location accessible by BBjServices.  Next, add the driver’s JAR file to the BBj classpath configuration using the Enterprise Manager by double-clicking on the Java Settings item in the navigator.  Next select the Classpath tab and add the JAR file to the default classpath.  Save the changes and then restart BBjServices for the changes to take effect.
For example to configure BBj for access to SQL Server databases, download and add the sqljdbc42.jar to BBj as described above from the following link:
Change your connection string to the correct SQL Server JDBC syntax as described in the following article:
A sample SQL Server connection string might look like this:
jdbc:sqlserver://myserver;user=myuser;password=mypassword
In addition to adding the JAR and changing the connection string, ensure that the JDBC driver class gets loaded before any connection attempts.  The driver only needs loaded one time after BBjServices starts.  Adding a reference to the driver class to the JDBC Drivers section of the sql.ini file located in the BBj cfg automatically loads the driver when BBjServices starts.  If there is no [JDBC Drivers] section, simply add it as follows:
[JDBC Drivers]
com.microsoft.sqlserver.jdbc.SQLServerDriver
Alternatively, a BBj program can include a single line of code somewhere in the program prior to any connection attempts.  The following line loads the JDBC driver class for use:
Class.forName(“com.microsoft.sqlserver.jdbc.SQLServerDriver”)
Some other examples of JDBC connection strings to common third party databases:
MySQL
     jdbc:mysql://myserver/mydatabase
Microsoft Access
    jdbc:ucanaccess:///Users/jdoe/mydb.mdb
Microsoft SQL Server
    jdbc:jtds:sqlserver://MYPC/Blog;instance=SQLEXPRESS;user=sa;password=s3cr3t
Oracle
    jdbc:oracle:thin:scott/tiger@localhost:1521:orcl
Table of Contents
Scroll to Top