156 DB2 for OS/390 and z/OS Powering the Worlds e-business
Before V7 DB2 for OS/390 provides support for a compiled Java stored
procedure only. A Java Virtual Machine (JVM) is not required for Java stored
procedures. They are compiled using the High Performance Java (HPJ)
compiler, which is part of VisualAge for Java Enterprise Edition for OS/390.
Compiled Java gives better performance than executing interpreted Java in a
JVM.
We discuss the following procedures for Java stored procedures:
Setting the system environment on page 156
Preparing compiled Java stored procedures on page 165
Runtime environment on page 172
Common errors on page 174
More information is reported in DB2 UDB for OS/390 and z/OS Version 7
Application Programming Guide and Reference for Java, SC26-9932, and DB2
Java Stored Procedures: Learning by Example, SG24-5945.
Refer to the following Web site for general information about stored procedures
in DB2 for OS/390:
http://ibm.com/software/data/db2/os390/spb/exciting/
Setting the system environment
In this section we summarize the setting for the system environment to run a
compiled Java stored procedure in an S/390 system. The interpreted Java stored
procedure is not available at the time of writing, but it will be available later on in
DB2 for OS/390 and z/OS Version 7 with APAR PQ46673.
DB2 V7 with APAR PQ46673 extends Java support for stored procedures
to allow interpreted Java stored procedures. Unlike compiled Java stored
procedures which are executed in the WLM stored procedure address
space, the Interpreted Java is invoked by the WLM stored procedure
address space, but is executed in a Java Virtual Machine (JVM) under
OS/390 UNIX System Services (USS).
Interpreted Java
Chapter 7. Developing DB2 Web applications with Java 157
The compilation of Java stored procedures into native OS/390 instructions is
done using the VisualAge for Java Enterprise Toolkit for OS/390 (ET/390)
through the use of the High Performance Java Compiler (HPJ) component of the
ET/390. We document how to install HPJ JDBC/SQLJ drivers, set up the
JAVAENV data set, and verify the contents of the JDBC cursors and SQLJ
properties files. In addition, we discuss some common setup issues.
First we cover the prerequisite software versions and the configuration steps.
Prerequisites for stored procedures
The following prerequisites are needed to run the Java stored procedures.
1. The JDBC and SQLJ requirements are given in Table 7-3.
Table 7-3 Java APAR requirements for DB2 for OS/390
For additional information, refer to the Web site:
http://ibm.com/s390/java
Version Feature APAR/PTF
Version 5 JDBC and SQLJ driver
including support for Visual
Age Java
PQ36643/UQ43898
Java stored procedures PQ31845/UQ46170
PQ31845/UQ46171
This support automatically
disables multi context
when running in Java
stored procedures
PQ39420/UQ49041
Version 6 JDBC and SQLJ driver
including support for Visual
Age Java
PQ36644/UQ43899
Java stored procedures PQ31846/UQ46114
PQ31846/UQ46115
This support automatically
disables multi context
when running in Java
stored procedures
PQ31846/UQ49039
158 DB2 for OS/390 and z/OS Powering the Worlds e-business
2. The VisualAge for Java Enterprise Edition for OS/390 requirements are given
in Table 7-4.
Table 7-4 VisualAge for Java Enterprise Edition requirements for OS/390
3. The Enterprise Toolkit for OS/390, part of VisualAge for Java, Enterprise
Edition: This product provides the HPJ compiler needed for Java stored
procedures on the OS/390 platform.
4. OS/390 Recoverable Resource Services (RRS) and Workload Manager
(WLM) Java stored procedures can only be run in a WLM-established stored
procedure address space, so implementation of OS/390 RRS is necessary.
Configuration
To prepare your OS/390 environment to execute Java stored procedures,
perform the following tasks.
1. Select the library structure.
2. Tailor the .profile script for the use of HPJ, SQLJ and JDBC, to ensure that the
necessary UNIX Systems Services (USS) environment variables are being
defined.
3. Setup WLM stored procedure address space.
4. Setup JAVAENV data set.
5. Install JDBC/SQLJ driver for OS/390.
Step 1: Select the library structure
When you select the library structure to contain external links and other
information that needs to be available at runtime, you must be careful. Because
the ENVAR variable of JAVAENV data set has the total length restriction of 245
characters.
Version Feature APAR/PTF
Version 2.0 VisualAge for Java,
Enterprise Edition for
OS/390
PQ38178/UQ43439 Rel.
2.01
PQ38179/UQ43443 Rel.
2.02

Get DB2 for OS/390 and z/OS Powering the World's e-business Solutions now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.