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.
- 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.getDriverName method:
- 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).
-
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"}}]
Was this topic helpful?
Document Information
Modified date:
15 June 2021
UID
ibm10876316