DB2 Version 9.7 for Linux, UNIX, and Windows

Upgrading Java applications that use IBM Data Server Driver for JDBC and SQLJ

Upgrading Java™ applications that use previous releases of the IBM® Data Server Driver for JDBC and SQLJ involves managing the changes between different releases of this driver and the changes in DB2® Version 9.7 that can impact these applications.

About this task

Restrictions

Before you begin

Procedure

To upgrade your Java database applications using the IBM Data Server Driver for JDBC and SQLJ to DB2 Version 9.7:

  1. Install the version of the IBM Data Server Driver for JDBC and SQLJ that corresponds to the version and fix pack level of your DB2 copy. See Java software support for DB2 products for a complete list of supported drivers.
    • If you use methods in JDBC 4.0 or earlier specifications in your applications, install IBM Data Server Driver for JDBC and SQLJ Version 4.7 or later.

    • If you use methods in JDBC 3.0 or earlier specifications in your applications, install IBM Data Server Driver for JDBC and SQLJ Version 3.57 or later
  2. If you are upgrading applications that use the IBM DB2 Driver for JDBC and SQLJ before Version 3.57, update your applications to manage the following differences between this driver and the IBM Data Server Driver for JDBC and SQLJ that you installed:
    • The IBM Data Server Driver for JDBC and SQLJ Version 4.0 or later returns a different result set than previous releases of this driver for the ResultSetMetaData.getColumnName and ResultSetMetaData.getColumnLabel methods to conform to the JDBC 4.0 standard. If you need these methods to return the same result set returned with the IBM DB2 Driver for JDBC and SQLJ before Version 4.0, you can set the useJDBC4ColumnNameAndLabelSemantics property to DB2BaseDataSource.NO in the Connection or DataSource object.
    • The IBM Data Server Driver for JDBC and SQLJ allows you to invoke the commit () or rollback () methods if the connection is in auto-commit mode and your application does not receive an exception anymore.
    • If the JNDI store is not available due to JNDI bind or lookup failures, then the IBM Data Server Driver for JDBC and SQLJ attempts a connection to the standard server and port properties of a datasource even when the datasource is configured to use JNDI for client reroute primaries and alternates. The driver now accumulates warnings to indicate these failures with the original message from the exception appended. In previous releases, the driver did not use this information and threw exceptions.
  3. If you are upgrading applications that use IBM DB2 Driver for JDBC and SQLJ before Version 3.1, update your applications to manage the following differences between this driver and the IBM Data Server Driver for JDBC and SQLJ that you installed:
    • If your applications connect to a DB2 server that supports progressive streaming, also known as dynamic data format, retrieving LOBs using progressive streaming is enabled by default starting with IBM DB2 Driver for JDBC and SQLJ Version 3.2 to provide improved performance to your Java database applications. You need to manage any changes in semantic that might impact your applications. Refer to LOBs in JDBC applications with the IBM Data Server Driver for JDBC and SQLJ for details.
    • If your application connects to a DB2 server that supports progressive streaming, and you want to continue using LOB locators instead of LOB retrieval using progressive streaming, set the progressiveStreaming property to:DB2BaseDataSource.NO in the Connection or DataSource object.
    • As of Version 3.0, you need to set the sendDataAsIs property to indicate if you want the driver to do the data type conversion or not. To maintain the conversion of input parameter values to the target column data types, which was the default behavior before IBM DB2 Driver for JDBC and SQLJ Version 3.0, set the sendDataAsIs property to false. If you set the sendDataAsIs property to true, the driver converts to the data type indicated by the setXXX method regardless of the information in the Connection or DataSource object.
    • If you use the JDBC 1.0 method to update or delete data on a database server that supports multiple-row FETCH and you intent to update or delete a single row, modify your applications to use the method described in Specifying updatability, scrollability, and holdability for ResultSets in JDBC applications to avoid updating or deleting multiple rows.
  4. If you changed your Java application source code, rebuild your Java application. Refer to one of the following tasks for details on how to rebuild them:

Results

Upon completion of this task, your Java application should perform successfully using DB2 Version 9.7.

What to do next

After upgrading your Java applications, perform the remaining steps in the upgrading database applications task.