Prerequisites for developing Java stored procedures

You might need to configure your system for developing Java™ stored procedures using the workbench.

About this task

The following sections contain setup and environment information.
JDK setup
If you are deploying a Java stored procedure, you must have a local JDK whose version is equal to or later than the version of the JRE on the database server. A JDK is included with the workbench product. If you want to use a different JDK, you can set the path to the JDK in one of three places:
  • In the Preferences window: Click Windows > Preferences . Expand the Data Management, the SQL Development, and the Routines nodes, and click Deploy Options. Set the path in the Java Home field.
  • In the Properties window for a data development project: Right-click a data development project and select Properties. In the Properties window, click Routine Development. Set the path in the JDK home field.
  • On the Routines Options page of the Deploy Routines wizard.
The project Properties setting is used for each project, unless there is no project Properties setting. If there is no project Properties setting, then the Preferences window setting is used. You can override both of these settings in the Deploy Routines wizard. If there is no JDK directory set, then you will see an error message when you deploy a Java stored procedure.
Running DB2® for z/OS® Java stored procedures using JDK 1.4.2
The default native HEAP size for JVM 1.42 is not sufficient for debugging Java stored procedures. If you are using JDK 1.4.2, you must increase to HEAP(8M,2M,ANYWHERE,KEEP). For example:
MSGFILE(JSPDEBUG,,,,ENQ), 
XPLINK(ON), 
HEAP(8M,2M,ANYWHERE,KEEP),
ENVAR("_CEE_ENVFILE=/u/oeusr05/CEEOPTIONS.txt")

Do not put the HEAP setting in the CEEOPTIONS.txt file. This step is not required if you are using JDK 1.5.

Java environment setup on Linux for IBM JDK 1.5.x or earlier

To deploy Java stored procedures on clients running the Linux or AIX® operating systems, or in the Solaris Operating Environment, you must manually point the workbench to the location of an installed JDK. These steps are not necessary for IBM JDK 1.6. To identify the location of a JDK, create a link to the directory where a JDK is installed. Replace db2admin in the example commands if your instance owner is named differently.

Set up the JDK directory
ln -s /opt/IBMJava2-131 /home/db2admin/sqllib/java/jdk
chown bin /home/db2admin/sqllib/java/jdk
chgrp bin /home/db2admin/sqllib/java/jdk
For IBM® Developer Kit 1.3
Set up symbolic links to libhpi.so, libjava.so, and libjvm.so by running the following commands:
cd /usr/lib
ln -fs JAVAHOME/jre/bin/libhpi.so
ln -fs JAVAHOME/jre/bin/libjava.so
ln -fs JAVAHOME/jre/bin/classic/libjvm.so
where JAVAHOME is the base directory for the IBM Developer kit. For example: /opt/IBMJava2-142 is the default base directory for the Developer kit 1.4.2.
For IBM Developer Kit 1.4.1
Follow the instructions for the IBM Developer kit 1.3. In addition to the three files that are required for 1.3, a symbolic link to libjsig.so is also required for 1.4.1. Run the following additional command to set up a link to libjsig.so. You will have a total of four links for 1.4.1:
cd /usr/lib
ln -fs JAVAHOME/jre/bin/libjsig.so
where JAVAHOME is the base directory for the IBM Developer kit.
For IBM Developer Kit 1.4.2
Follow the instructions for the IBM Developer kit 1.3 and 1.4.1. In addition to the four files that are required for 1.3 and 1.4.1, a symbolic links to libjitc.so, libxhpi.so, and libdbgmalloc.so are also required for 1.4.2. Run the following additional command as root to set up links to libjitc.so, libxhpi.so, and libdbgmalloc.so. You will have a total of seven links for 1.4.2:
ln -fs JAVAHOME/jre/bin/libjitc.so   
ln -fs JAVAHOME/jre/bin/libxhpi.so
ln -fs JAVAHOME/jre/bin/libdbgmalloc.so
ldconfig
where JAVAHOME is the base directory for the IBM Developer kit.
For IBM Developer Kit 1.5
For the IBM Java Developer Kit 1.5.0, set up the following symbolic links by running the following commands as root. Ignore any files in this list that do not exist in your Java directory.
cd /usr/lib
ln -fs JAVAHOME/jre/bin/libjava.so
ln -fs JAVAHOME/jre/bin/classic/libjvm.so
ln -fs JAVAHOME/jre/bin/libhpi.so
ln -fs JAVAHOME/jre/bin/libjsig.so
ln -fs JAVAHOME/jre/bin/libjitc.so
ln -fs JAVAHOME/jre/bin/libxhpi.so
ln -fs JAVAHOME/jre/bin/libdbgmalloc.s
where JAVAHOME is the base directory for the IBM Developer kit.
For every Developer kit version, run ldconfig as root after setting up the symbolic links. This command creates the necessary links and cache (for use by the run time linker, ld.so) to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/usr/lib and /lib). Also, ensure that your userid home directory is +rx by all.

Feedback