DB2 Version 9.7 for Linux, UNIX, and Windows

Upgrading Java routines

Upgrading your existing Java™ routines to DB2® Version 9.7 involves managing the changes between DB2 Version 9.7 and previous releases that impact these routines and ensure that these routines function as expected.

Before you begin

The following prerequisites must be met to perform this task:

Procedure

To upgrade your Java routines:

  1. Ensure the jdk_path database manager configuration parameter specifies the installation path of the IBM® Software Developer's Kit (SDK) for Java that is installed on your DB2 server. Determine the current value of this parameter by issuing the following command:
       db2 GET DBM CFG
    By default the jdk_path database manager configuration parameter value is set during instance upgrade to the values shown in Table 1 which are the installation path of SDK for Java 6.
    If you must use an SDK for Java other than the one installed in your DB2 Version 9.7 copy, set this configuration parameter to the installation path of an SDK for Java with the same bit width as the DB2 instance by updating the jdk_path parameter:
       db2 UPDATE DBM CFG USING jdk_path SDKforJava-path

    However, setting the jdk_path parameter to the installation path of SDK for Java 1.4.2 is not recommended because SDK for Java 1.4.2 is deprecated and might be discontinued in a future release.

  2. Set the DB2_USE_DB2JCCT2_JROUTINE registry variable to indicate the default JDBC driver to run Java routines. By default this registry variable is not set, which means the default JDBC driver is the IBM Data Server Driver for JDBC and SQLJ. This setting gives you access to functionality particular to this driver and use of XML parameters. Use the db2set command with the -g parameter to set the default JDBC driver for all instances running under the same DB2 Version 9.7 copy:
    Default driver Command to set default driver
    IBM DB2 JDBC Type 2 driver db2set -g DB2_USE_DB2JCCT2_JROUTINE=NO
    IBM Data Server Driver for JDBC and SQLJ db2set -g DB2_USE_DB2JCCT2_JROUTINE=YES
    Use the -i parameter instead of the -g parameter, to apply the registry variable setting to a specific instance.
  3. Test your Java routines in your DB2 Version 9.7 database. If testing is successful and your Java routine perform as expected, you do not need to perform any additional steps.
  4. If you are using the IBM Data Server Driver for JDBC and SQLJ and found any differences in the behavior of your Java routines, review Upgrading Java applications that use IBM Data Server Driver for JDBC and SQLJ to learn how to manage those differences.
  5. If the pre-upgrade value of the jdk_path parameter was the installation path of SDK for Java 1.4.2, manage any differences in behavior between SDK for Java 1.4.2 and SDK for Java 6.
  6. Explicitly define your Java routines as fenced using the ALTER FUNCTION or ALTER PROCEDURE statement with the FENCED clause. All Java routines run as fenced, regardless of how you defined them, but defining your Java routine definitions as fenced improves routine manageability and maintenance.
  7. Optional: If your Java routine class is included within a JAR file that has been installed into a DB2 instance using a specific JAR file ID, ensure that the Java class is resolved more quickly by the DB2 database manager by specifying the JAR file ID as part of the EXTERNAL NAME clause in the routine definition. Use the ALTER PROCEDURE or ALTER FUNCTION statement to update the EXTERNAL NAME clause if required.
  8. If you created projects in the Development Center to develop your Java routines, upgrade any existing projects to the Data Studio using the upgrade wizard.

What to do next

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