Upgrading Java routines

Upgrading your existing Java™ routines to Db2® version 11.5 involves managing the changes between Db2 version 11.5 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:
  • Ensure that you have access to a Db2 version 11.5 server, including instances and databases. The Db2 server can be a test system.
  • Ensure that the Java routine development software is at a version level that is supported by Db2 database products.
  • Ensure that you are using supported Db2 drivers for JDBC and SQLJ APIs.
  • Ensure that you have the necessary authorizations and privileges to use the ALTER FUNCTION or ALTER PROCEDURE statements. The authorizations allowed are listed in the SQL Reference Volume 2.
  • Perform the previous steps in the upgrading routines task.


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 Upgrade essentials for routines which are the installation path of SDK for Java 8.
    If you must use an SDK for Java other than the one installed in your Db2 version 11.5 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
  2. Test your Java routines in your Db2 version 11.5 database. If testing is successful and your Java routine perform as expected, you do not need to perform any additional steps.
  3. If you 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.
  4. If the pre-upgrade value of the jdk_path parameter was the installation path of SDK for Java 6 or Java 1.4.2, manage any differences in behavior between the SDK specified by the jdk_path parameter and the SDK for Java 8.
  5. 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.
  6. 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.
  7. If you created projects in the Development Center to develop your Java routines, upgrade any existing projects to the IBM Data Studio using the upgrade wizard.

What to do next

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