Prerequisites for developing routines

You must install and configure the necessary prerequisites before you can develop routines (stored procedures and user-defined functions (UDFs)) using the workbench.

Before you develop routines using the workbench, you must complete all setup and configuration steps for your operating system and the type of routine that you are developing as described in the IBM DB2 Application Development Guide. The following information supplements the information in the IBM DB2 Application Development Guide but does not replace it.

For detailed information about setup requirements for developing DB2® for z/OS® and OS/390® routines, see the Redbook DB2 for z/OS Stored Procedures: Through the CALL and Beyond at http://publib-b.boulder.ibm.com/abstracts/sg247083.html?Open

General prerequisites

To build SQL stored procedures for DB2 UDB versions prior to 8.2 or for DB2 for z/OS, you must install and configure a C compiler on the server. For more information, see the IBM DB2 Application Development Guide.

If you are building a Java™ stored procedure, you must have a local JDK that matches the servers JDK. In addition, you must set the path to the JDK you are using in one of two places:
  • In the Preferences window: Click Windows > Preferences . Expand the Data and Stored Procedures and User-Defined Functions nodes, and click Deploy Options. Set the path in the Java Home Directory 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.
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. If there is no JDK directory set in either place, then you will see an error message when you deploy a Java stored procedure.

The following table lists prerequisites for both the server system and the client workstation where the workbench is installed.

See License requirements for all DB2 database connections for information about license files that are required for database connectivity to DB2 databases.

Table 1. Prerequisites
Platform Server requirements Client requirements
DB2 for Linux™, UNIX®, and Windows® DB2, version 8 or later

None

DB2 UDB for z/OS and OS/390 DB2, version 7 or later

None

DB2 UDB for iSeries™
  • DB2 UDB for iSeries, version 5.2 or later (SQL stored procedures only)
  • DB2 UDB for iSeries, version 5.3 or later (SQL and Java stored procedures)

For DB2 UDB for iSeries, version 5.2: AS400 Toolbox for Java (jt400.jar)

To download, see Toolbox for Java at http://www.ibm.com/servers/eserver/iseries/toolbox/downloads.html

Derby Derby, version 10

None

General Linux® prerequisites
If you are working with the workbench on Linux, you must specify the path to DB2. To set the path to DB2, modify the .profile file in your /home/userhome directory by adding the following line of code:
export DB2PATH=/home/userhome/sqllib
Java environment setup on Linux

To develop 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. 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 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.

For more information about developing routines and applications for DB2, refer to the library of information that comes with DB2, including the IBM DB2 Application Development Guide.

Related concepts
Creating stored procedures
Creating user-defined functions (UDFs)
Working with stored procedures
User-defined functions (UDFs)
Related tasks
Creating database routines

Feedback