IBM Support

Upgrading from the IBM Data Server Driver for JDBC and SQLJ with JDBC 3.0 support to the IBM Data Server Driver for JDBC and SQLJ with JDBC 4.0 support

How To


Summary

Use this procedure to modify your Java environment and applications to use only the version of the IBM Data Server Driver for JDBC and SQLJ that supports JDBC 4.0 and later. Applicable to all databases such as Db2 for z/OS, Db2 for LUW , Db2 for Iseries, Informix etc

Objective

Previously, the IBM Data Server Driver for JDBC and SQLJ had two versions:

  • A version that supports JDBC 3.0 and earlier (referred to as the JDBC 3.x version in this article)
  • A version that supports JDBC 4.0 and later, as well as JDBC 3.0 and earlier (referred to as the JDBC 4.x version in this article)
Beginning with the driver that is delivered with Db2 11.5 (for Linux, UNIX, and Windows), the JDBC 3.x version is no longer included or supported. Therefore, you need to upgrade to the JDBC 4.x version.

Steps

To upgrade to the JDBC 4.x version of the IBM Data Server Driver for JDBC and SQLJ, perform these steps.

  1. Update your CLASSPATH environment variable to include db2jcc4.jar and sqlj4.zip, and not db2jcc.jar and sqlj.zip.
    • Because the strings db2jcc4.jar and sqlj4.zip are longer than db2jcc.jar and sqlj.zip, you might need to adjust the CLASSPATH if it is already at the maximum length.
  2. Upgrade the Java runtime environment to JRE 1.6 or higher.
  3. In application server data source configurations, such as JDBC providers for WebSphere Application Server, change references in data source definitions from db2jcc.jar to db2jcc4.jar, and from sqlj.zip to sqlj4.zip.
  4. Modify applications to remove dependencies on the JDBC 3.x version of the driver. For example, you need to make changes to applications that include the following items:
      • Applications that invoke the DatabaseMetaData.getDriverName method:
        • The method returns "IBM DB2 JDBC Universal Driver Architecture" under the JDBC 3.x driver version.
        • The method returns "IBM Data Server Driver for JDBC and SQLJ" under the JDBC 4.x driver version.
      • Applications that invoke the DatabaseMetaData.getJDBCMajorVersion method:
        • The method returns 3 under the JDBC 3.x driver version.
        • The method returns 4 under the JDBC 4.x driver version.
      • Applications that invoke the ResultSetMetaData.getColumnName or ResultSetMetaData.getColumnLabel method against a result set column on which a label or an AS clause is defined:
        Different results are returned, depending on the driver version and the data server. After you switch to the JDBC 4.x version of the driver, you might still need the JDBC 3.x results. You can set the useJDBC4ColumnNameAndLabelSemantics Connection and DataSource property to DB2BaseDataSource.NO (2) to continue to retrieve the JDBC 3.x results ResultSetMetaData.getColumnName or ResultSetMetaData.getColumnLabel invocations.
    • Applications that invoke the DatabaseMetaData.getColumns method:
      The method returns a result set with a column named SCOPE_CATLOG under the JDBC 3.x driver version. That column is named SCOPE_CATALOG under the JDBC 4.x driver version. After you switch to the JDBC 4.x version of the driver, if you need DatabaseMetaData.getColumns to continue to return the SCOPE_CATLOG column name,  set DataSource or Connection property useJDBC41DefinitionForGetColumns to DB2BaseDataSource.NO (2).
    • Applications that invoke the ParameterMetaData.getParameterType and ResultSetMetaData.getColumnType methods, when parameters have the SQL GRAPHIC, VARGRAPHIC, DBCLOB, or XML data type:
      The JDBC 4.0 specification introduces new java.sql.Types constants for the SQL GRAPHIC, VARGRAPHIC, DBCLOB, and XML data types. With the JDBC 4.x version of the driver, the ParameterMetaData.getParameterType and  ResultSetMetaData.getColumnType methods returns the new constants. Those constants are: 
      • java.sql.Types.NCHAR (-15) for the GRAPHIC data type
      • java.sql.Types.NVARCHAR (-9) for the VARGRAPHIC data type
      • java.sql.Types.NCLOB (2011) for the DBCLOB data type
      • java.sql.Types.SQLXML (2009) for the XML data type

      If your applications check for parameters of the GRAPHIC, VARGRAPHIC, DBCLOB, or XML data type, you need to use the new data type constants for comparison.
  5. If you deliver any products or solutions that include the IBM Data Server Driver for JDBC and SQLJ with JDBC 3.0 support, you need to modify those products or solutions to include the IBM Data Server Driver for JDBC and SQLJ with JDBC 4.0 support.
  6. On Db2 for z/OS, the startup procedure for a WLM address space in which Java stored procedures run includes a JAVAENV data set. That data set contains Language Environment run-time options for Java stored procedures. You need to modify the following suboptions of the ENVAR option:
    • In the CLASSPATH suboption, change db2jcc.jar and sqlj.zip to db2jcc4.jar and sqlj4.zip.
    • Set the JDBCSTD suboption to 4.

Document Location

Worldwide

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSEPDU","label":"DB2 Connect"},"ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSEPGG","label":"DB2 for Linux, UNIX and Windows"},"ARM Category":[{"code":"a8m0z0000001jHFAAY","label":"Connectivity->JDBC"}],"Platform":[{"code":"PF016","label":"Linux"},{"code":"PF033","label":"Windows"}],"Version":"All Version(s)","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
15 June 2021

UID

ibm10876316