Before implementing these instructions, do the setup in Setting up the UNIX Java environment.
Procedure
To build Java applications on Linux with DB2 JDBC support, you need to install and configure on your development machine:
To run Java stored procedures or user-defined functions, the Linux run-time linker must be able to access certain Java shared libraries, and DB2 must be able to load both these libraries and the Java virtual machine. Since the program that does this loading runs with setuid privileges, it will only look for the dependent libraries in /usr/lib.
Create symbolic links in /usr/lib to point to the Java shared libraries. The number of required shared libraries that you will need to link to depends on the version of the IBM Developer Kit that you are using.
IBM Developer Kit 1.3
You require symbolic links to libjava.so, libjvm.so, and libhpi.so. You can create the symbolic links by running the following commands as root:
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 .
where JAVAHOME is the base directory for the IBM Developer
Kit.
|IBM Developer Kit 1.4.1
|You require symbolic links to libjava.so,
|libjvm.so, libhpi.so, and
|libjsig.so. You can create the symbolic links by
|running the following commands as root:
|where JAVAHOME is the base directory for the IBM Developer
|Kit. |IBM Developer Kit 1.4.2
|You require symbolic links to libjava.so,
|libjvm.so, libhpi.so,
|libjsig.so, libjitc.so,
|libxhpi.so, and libdbgmalloc.so.
|You can create the symbolic links by running the following commands as
|root:
|where JAVAHOME is the base directory for the IBM Developer
|Kit.| 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 .
| 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.so .
| ldconfig
If DB2 cannot find these libraries, you will get a -4301 error when trying to run a Java routine, and there will be messages in the administration notification log about libraries not found.