Specifying JDK for Java routine development (Linux® and UNIX)

To build and run Java™ routine code, you must set the JDK_PATH database manager configuration parameter to the Java Development Kit (JDK) installation path on the database server.

Before you begin

The IBM® database server products and IBM data server client products installs the JDK by default and the JDK_PATH database manager configuration parameter is set to the $INSTDIR/sqllib/java/jdk64 path.

The JDK_PATH parameter value can be changed to specify another JDK that is installed on the computer. However, the JDK must be of the same bit-width as the IBM data server product that is installed.

The following conditions must be met before you can set the JDK_PATH database manager configuration parameter:
  • User must have access to the database server.
  • User must have the authority to read and update the database manager configuration file.
  • User must have authority to install the JDK in a file system where the IBM data server product is installed.

Procedure

  1. Check the JDK_PATH parameter value with the get dbm cfg command from the Db2® command window:
      db2 get dbm cfg
    You might want to redirect the output to a file for easier viewing.
    The JDK_PATH parameter value appears near the beginning of the output.
  2. If you want to use a different JDK, install the JDK on the database server and note the JDK installation path.
  3. Update the JDK_PATH parameter value with the update dbm cfg command from the Db2 command window, where path is the path where the new JDK is installed:
      db2 update dbm cfg using JDK_PATH path
  4. Stop and restart the database manager:
    db2stop
    
    db2start
  5. Verify the JDK_PATH parameter value by running the following command:
      db2 get dbm cfg

What to do next

After you complete these steps, the JDK that is specified with the JDK_PATH parameter is used to run Java routines. The CLASSPATH, PATH, and LIBPATH environment variables for JDK are set automatically when the JDK_PATH parameter is set.