To build Java applications on AIX with DB2 JDBC support, you need to install and configure the following on your development machine:
The JDBC 1.22 driver is still the default driver on all operating systems, including AIX. To take advantage of the new features of JDBC 2.0, you must install both the JDBC 2.0 driver and JDK 1.2 support for your platform. To install the JDBC 2.0 driver for AIX, enter the usejdbc2 command from the sqllib/java12 directory. This command performs the following tasks:
To switch back to the JDBC 1.22 driver, execute the usejdbc1 command from the sqllib/java12 directory.
To run DB2 Java stored procedures or UDFs, you need to update the DB2 database manager configuration on the server to include the path where the JDK is installed on that machine. You can do this by entering the following on the server command line:
db2 update dbm cfg using JDK11_PATH /home/db2inst/jdk11
where /home/db2inst/jdk11 is the path where the JDK is installed.
You can check the DB2 database manager configuration to verify the correct value for the JDK11_PATH field by entering the following command on the server:
db2 get dbm cfg
You may want to redirect the output to a file for easier viewing. The JDK11_PATH field appears near the beginning of the output. For more information on these commands, see the Command Reference.
To run JDBC and SQLJ programs on AIX with DB2 JDBC support, commands to update the AIX Java environment are included in the database manager files db2profile and db2cshrc. When a DB2 instance is created, .profile and/or .cshrc are modified so that CLASSPATH includes:
To build SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/sqlj.zip
To run SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/runtime.zip
To build Java applications on HP-UX with DB2 JDBC support, you need to install and configure the following on your development machine:
To run DB2 Java stored procedures or UDFs, you also need to update the DB2 database manager configuration on the server to include the path where the JDK is installed on that machine. You can do this by entering the following on the server command line:
db2 update dbm cfg using JDK11_PATH /home/db2inst/jdk11
where /home/db2inst/jdk11 is the path where the JDK is installed.
You can check the DB2 database manager configuration to verify the correct value for the JDK11_PATH field by entering the following command on the server:
db2 get dbm cfg
You may want to redirect the output to a file for easier viewing. The JDK11_PATH field appears near the beginning of the output. For more information on these commands, see the Command Reference.
To run JDBC and SQLJ programs on HP-UX with DB2 JDBC support, commands to update the HP-UX Java environment are included in the database manager files db2profile and db2cshrc. When a DB2 instance is created, .profile and/or .cshrc are modified so that:
To build SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/sqlj.zip
To run SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/runtime.zip
To build Java applications on Linux with DB2 JDBC support, you need to install and configure the following on your development machine:
To run DB2 Java stored procedures or UDFs, you also need to update the DB2 database manager configuration on the server to include the path where the JDK is installed on that machine. You can do this by entering the following on the server command line:
db2 update dbm cfg using JDK11_PATH /usr/local/jdk118
where /usr/local/jdk118 is the path where the JDK is installed.
You can check the DB2 database manager configuration to verify the correct value for the JDK11_PATH field by entering the following command on the server:
db2 get dbm cfg
You may want to redirect the output to a file for easier viewing. The JDK11_PATH field appears near the beginning of the output. For more information on these commands, see the Command Reference.
Note: | On Linux, the Java Virtual Machine implementation does not work well in
programs that run in a "setuid" environment. The shared library that
contains the Java interpreter, libjava.so, may fail to
load. As a workaround, you can create a symbolic link to the JVM shared
library in /usr/lib, with a command similar to the following
(depending on where Java is installed on your machine):
ln -s /usr/local/jdk118/lib/linux/native_threads/libjava.so /usr/libFor more information on this and other workarounds available, please visit: http://www.ibm.com/software/data/db2/java/faq.html |
To run JDBC and SQLJ programs on Linux with DB2 JDBC support, commands to update your Linux Java environment are included in the database manager files db2profile and db2cshrc. When a DB2 instance is created, .bashrc, .profile, and/or .cshrc are modified so that:
To build SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/sqlj.zip
To run SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/runtime.zip
To build Java applications on OS/2 with DB2 JDBC support, you need to install and configure the following on your development machine:
The JDK must be installed in an HPFS drive to allow long filenames with extensions greater than three characters, such as .java. Your Java working directory must also be on an HPFS drive. If you will be running Java stored procedures or UDFs on an OS/2 server, DB2 must be installed on an HPFS drive on the server in order to allow the stored procedure or UDF .class files to be placed in the %DB2PATH%\function directory.
To run DB2 Java stored procedures or UDFs, you need to update the DB2 database manager configuration on the server to include the path where the JDK is installed on that machine. You can do this by entering the following on the server command line:
db2 update dbm cfg using JDK11_PATH c:\jdk11
where c:\jdk11 is the path where the JDK is installed.
You can check the DB2 database manager configuration to verify the correct value for the JDK11_PATH field by entering the following command on the server:
db2 get dbm cfg
You may want to redirect the output to a file for easier viewing. The JDK11_PATH field appears near the beginning of the output. For more information on these commands, see the Command Reference.
To run JDBC and SQLJ programs on OS/2 with DB2 JDBC support, the CLASSPATH environment variable is automatically updated when DB2 is installed to include:
To build SQLJ programs, CLASSPATH is also updated to include the file:
%DB2PATH%\java\sqlj.zip
To run SQLJ programs, CLASSPATH is also updated to include the file:
%DB2PATH%\java\runtime.zip
To build Java applications on PTX with DB2 JDBC support, you need to install and configure the following on your development machine:
To run DB2 Java stored procedures or UDFs, you also need to update the DB2 database manager configuration on the server to include the path where the ptx/JSE is installed on that machine. You can do this by entering the following on the server command line:
db2 update dbm cfg using JDK11_PATH /opt/jse3.0
where /opt/jse3.0 is the path where the ptx/JSE is installed.
You can check the DB2 database manager configuration to verify the correct value for the JDK11_PATH field by entering the following command on the server:
db2 get dbm cfg
You may want to redirect the output to a file for easier viewing. The JDK11_PATH field appears near the beginning of the output. For more information on these commands, see the Command Reference.
To run JDBC and SQLJ programs on PTX with DB2 JDBC support, commands to update the PTX Java environment are included in the database manager files db2profile and db2cshrc. When a DB2 instance is created, .profile and/or .cshrc are modified so that CLASSPATH includes:
To build SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/sqlj.zip
To run SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/runtime.zip
To build Java applications on Silicon Graphics IRIX with DB2 JDBC support, you need to install and configure the following on your development machine:
Note: | SQLJ applications on Silicon Graphics IRIX can only be built with the o32
object type. To change the Java default object type to o32, set the
environment variable SGI_ABI with the Korn shell using this
command:
export SGI_ABI=-o32 and with the C shell using this command: setenv SGI_ABI -o32 |
DB2 for Silicon Graphics IRIX is client-only. To run DB2 applications and applets, and to build DB2 embedded SQL applications and applets, you need to access a DB2 database on a server machine from your client machine. The server machine will be running a different operating system. See DB2 for UNIX Quick Beginnings for information on configuring client-to-server communication.
Also, since you will be accessing a database on the server from a remote client that is running on a different operating system, you need to bind the database utilities, including the DB2 CLI, to the database. See "Binding" for more information.
To run DB2 Java stored procedures or UDFs, you also need to update the DB2 database manager configuration on the server to include the path where the JDK is installed on that machine. You can do this by entering the following on the server command line:
db2 update dbm cfg using JDK11_PATH /home/db2inst/jdk11
where /home/db2inst/jdk11 is the path where the JDK is installed.
You can check the DB2 database manager configuration to verify the correct value for the JDK11_PATH field by entering the following command on the server:
db2 get dbm cfg
You may want to redirect the output to a file for easier viewing. The JDK11_PATH field appears near the beginning of the output. For more information on these commands, see the Command Reference.
To run JDBC and SQLJ programs on Silicon Graphics IRIX with DB2 JDBC support, commands to update the Silicon Graphics IRIX Java environment are included in the database manager files db2profile and db2cshrc. When a DB2 instance is created, .profile and/or .cshrc are modified so that CLASSPATH includes:
To build SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/sqlj.zip
To run SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/runtime.zip
Note: | On Silicon Graphics IRIX, the connection context close() method may cause a trap. As a work-around, leave the connection context to be closed automatically during garbage collection. |
To build Java applications in the Solaris operating environment with DB2 JDBC support, you need to install and configure the following on your development machine:
The JDBC 1.22 driver is still the default driver on all operating systems, including Solaris. To take advantage of the new features of JDBC 2.0, you must install both the JDBC 2.0 driver and JDK 1.2 support for your platform. To install the JDBC 2.0 driver for Solaris, enter the usejdbc2 command from the sqllib/java12 directory. This command performs the following tasks:
To switch back to the JDBC 1.22 driver, execute the usejdbc1 command from the sqllib/java12 directory.
To run DB2 Java stored procedures or UDFs, you need to update the DB2 database manager configuration on the server to include the path where the JDK is installed on that machine. You can do this by entering the following on the server command line:
db2 update dbm cfg using JDK11_PATH /usr/java
where /usr/java is the path where the JDK is installed.
You can check the DB2 database manager configuration to verify the correct value for the JDK11_PATH field by entering the following command on the server:
db2 get dbm cfg
You may want to redirect the output to a file for easier viewing. The JDK11_PATH field appears near the beginning of the output. For more information on these commands, see the Command Reference.
Note: | In the Solaris operating environment, some Java Virtual Machine
implementations do not work well in programs that run in a "setuid"
environment. The shared library that contains the Java interpreter,
libjava.so, may fail to load. As a workaround, you
can create symbolic links for all needed JVM shared libraries in
/usr/lib, with a command similar to the following (and depending on
where Java is installed on your machine):
ln -s /usr/java/lib/*.so /usr/libFor more information on this and other workarounds available, please visit: http://www.ibm.com/software/data/db2/java/faq.html |
To run JDBC and SQLJ programs in the Solaris operating environment with DB2 JDBC support, commands to update the Solaris Java environment are included in the database manager files db2profile and db2cshrc. When a DB2 instance is created, .profile and/or .cshrc are modified so that:
To build SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/sqlj.zip
To run SQLJ programs, CLASSPATH is also updated to include the file:
sqllib/java/runtime.zip
To build Java applications on a Windows 32-bit platform with DB2 JDBC support, you need to install and configure the following on your development machine:
The JDBC 1.22 driver is still the default driver on all operating systems, including Windows 32-bit. To take advantage of the new features of JDBC 2.0, you must install both the JDBC 2.0 driver and JDK 1.2 support for your platform. To install the JDBC 2.0 driver for Windows 32-bit operating systems, enter the usejdbc2 command from the sqllib\java12 directory. This command performs the following tasks:
To switch back to the JDBC 1.22 driver, execute the usejdbc1 batch file from the sqllib\java12 directory.
To run DB2 Java stored procedures or UDFs, you need to update the DB2 database manager configuration on the server to include the path where the JDK is installed on that machine. You can do this by entering the following on the server command line:
db2 update dbm cfg using JDK11_PATH c:\jdk11
where c:\jdk11 is the path where the JDK is installed.
Note: | If the path where the JDK is installed contains a directory name with one or
more spaces, put the path in single quotes. For example:
db2 update dbm cfg using JDK11_PATH 'c:\Program Files\jdk11' |
You can check the DB2 database manager configuration to verify the correct value for the JDK11_PATH field by entering the following command on the server:
db2 get dbm cfg
You may want to redirect the output to a file for easier viewing. The JDK11_PATH field appears near the beginning of the output. For more information on these commands, see the Command Reference.
To run JDBC and SQLJ programs on a supported Windows platform with DB2 JDBC support, CLASSPATH is automatically updated when DB2 is installed to include:
To build SQLJ programs, CLASSPATH is also updated to include the file:
%DB2PATH%\java\sqlj.zip
To run SQLJ programs, CLASSPATH is also updated to include the file:
%DB2PATH%\java\runtime.zip
To specify which Java Development Kit to use for DB2 SQLJ, DB2 installs the environment variable DB2JVIEW on Windows 32-bit operating systems. It applies to all DB2 SQLJ commands (db2profc, db2profp, profdb, profp and sqlj).
If the default setting of "DB2JVIEW=0" is used, or DB2JVIEW is not set, the Sun JDK will be used; that is, if you call "profp", it will run as "java sqlj.runtime.profile.util.ProfilePrinter". If "DB2JVIEW=1", the Microsoft SDK for Java will be used; that is, if you call "profp", it will run as "jview sqlj.runtime.profile.util.ProfilePrinter".