IBM Support

Migrating from the JDBC 3 driver to the JDBC 4 driver

How To


Summary

The following document lists the steps to migrate from the JDBC 3 driver (db2jcc.jar, sqlj.zip) to the JDBC 4 Driver (db2jcc4.jar, sqlj4.zip).

Objective

The JDBC 4 driver is based on JDBC 4.0 and higher specification. Details of the specification are available here: https://jcp.org/en/jsr/detail?id=221. As mentioned in section 2.10 of the above link “This specification will build on top of JSR-054, JDBC 3.0 Specification.”
The JDBC 3 driver is based on JDBC 3.0 specification and is aligned with JRE1.4 which is out of support.

Our recommendation is to upgrade to the JDBC 4 driver which is based on JDBC 4.0 and higher specification.


Steps

In this document the JDBC 3 driver refers to db2jcc.jar and sqlj.zip, and the JDBC 4 driver refers to db2jcc4.jar and sqlj4.zip.

  1. Update the CLASSPATH environment variable - Update your CLASSPATH environment variable to point to the JDBC 4 driver. Remove the JDBC 3 driver from your CLASSPATH if both JDBC 3 and JDBC 4 drivers are present. 

  2. Upgrade the Java Runtime Environment (JRE) - The minimum supported JRE for the JDBC 4 driver is JRE1.6. Migrate your JRE to 1.6 or higher. 

  3. Change Application Configuration - Update your application to point to the JDBC 4 driver in place of the JDBC 3 driver. E.g. In Websphere Application server, the JNDI data sources pointing to the JDBC driver .jar files should instead point to the JDBC 4 driver. 

  4. Change Application (if applicable) - There are few known differences between the JDBC 3 and JDBC 4 drivers. Update your application if it uses any of the following: 

    1. The JDBC 3 driver name string is "IBM DB2 JDBC Universal Driver Architecture". The JDBC 4 driver string is "IBM Data Server Driver for JDBC and SQLJ". If your application uses the JDBC 3 driver name, change it to the JDBC 4 driver name. 

    2. The DatabaseMetaData.getJDBCMajorVersion() API returns 3 as an integer for the JDBC 3 driver and 4 as an integer for the JDBC 4 driver. If your application uses this API, change it accordingly. 

    3. The JDBC 4 driver follows the JDBC 4.0 and higher specification, as per the specification the behaviour of some APIs has changed. If your application uses the following APIs using the JDBC 4 driver you will experience a difference in behaviour. If you want the JDBC 3 behaviour then set the corresponding property to false, by default the property is set to true in the JDBC 4 driver. 

      1. JDBC4ColumnNameAndLabelSemantics property for ResultSetMetaData.getColumnName(), ResultSetMetaData.getColumnLabel(), and ResultSet.findColumn() APIs. 

      2. JDBC41DefinitionForGetColumns property for DatabaseMetaData.getColumns() API. 

  5. JDBC .jar file bundling - If your product bundles the JDBC 3 driver, change your packaging or bundling script to use the JDBC 4 driver. 

Document information

More support for: DB2 for Linux, UNIX and Windows

Component: Migrating from JDBC 3 driver to JDBC 4 driver

Software version: 11.5

Operating system(s): Linux, Reliant UNIX, Windows

Reference #: 0872632

Modified date: 04 March 2019