 | Level: Introductory Peggy Rader (peggyr@us.ibm.com), Senior Software Engineer, IBM
23 Sep 2004 Understand what your Java™ Software Development Kit (SDK) selection options are when you use the DB2® Development Center (DC) to create Java stored procedures on OS/390® and z/OS® platforms. Also, apply this information when you create Java stored procedures in the WebSphere Studio products, WebSphere® Studio Application Developer (WSAD), WebSphere Studio Application Developer Integrated Edition (WSADIE) or WebSphere Studio Enterprise Developer (WSED) for creating Java stored procedures on OS/390 and z/OS platforms.
Overview
Both Java Software Development Kit (SDK) 1.3.1, and SDK 1.4.1 are supported when creating Java stored procedures on DB2 for OS/390 Version 7 and DB2 for z/OS Version 8. The two areas that reference an SDK are:
- The build time of the stored procedure by DC (which includes the generated Java-source), and the subsequent compilation of that source
- The run time (at run time) of the stored procedure in the Work Load Manager (WLM) Stored Procedure Address Space (SPAS)
The Java methods you use during build time must be available at run time in the Java Run time Environment (JRE), otherwise an execution error indicating a mismatch will occur in the WLM-managed stored procedure address space (WLM SPAS). For example, using a Java stored procedure that includes a Java SDK 1.4.1 method, will fail if it executes in a WLM SPAS referencing a Java 1.3.1 JRE.
 | |
DB2 Development Center is no longer available. This article remains for those who already have the DB2 Development Center with DB2 V8 or earlier. If you have DB2 9 or later, please download IBM Data Studio.
|
|
DC is included in the Application Development Client (ADC) of DB2 Universal Database™ (UDB). There are two DC releases available, DB2 UDB Version 8.1 (DC 8.1) which includes fixpaks (FP) from FP1 through FP7, and DB2 UDB Version 8.2 (DC 8.2). DB2 UDB Version 8.1 (FP7 level) is equal to the base DB2 UDB Version 8.2 code level. The term SDK is used on the z/OS server and either Java Development Kit (JDK) or SDK is used on the client workstation.
It is important to note that while this paper is targeted at the DC-user, the information described for the set up of the run time environment of the WLM SPAS, also applies if the Java stored procedure is created without DC.
Build time processing by DC
During build time you should select whether or not you want to use the DB2-supplied DSNTJSPP stored procedure. Processing against DB2 for OS/390 Version 7 requires DSNTJSPP for the build process. However, if you are using DC 8.2 and processing against a DB2 for z/OS Version 8 server, selecting DSNTJSPP for the build process is optional.
When you use DSNTJSPP, the set up of the Hierarchical File System (HFS)
DSNTJSPP.properties file is required. This file includes the JAVA_HOME environment variable that identifies whether SDK 1.3.1 or SDK 1.4.1 is being used. The default directory for the Java SDK 1.3.1 is /usr/lpp/java/IBM/J1.3. The default directory for the Java SDK 1.4.1 is /usr/lpp/java/IBM/J1.4. If you do not use DSNTJSPP for the build processing, (supported only from DC 8.2 processing against a DB2 for z/OS Version 8), the generated Java stored procedure source and subsequent compilation of that source uses the SDK specified on the workstation.
A default SDK is included with DB2 UDB and used by DC. For DB2 UDB Version 8.1, including fixpaks through FP6, the SDK is level 1.3.1. For DB2 UDB Version 8.2 and DB2 UDB Version 8.1, including FP7, the default SDK is level 1.4.1. The default directory for the SDK is ..\sqllib\java\jdk.
Overriding the default SDK
Overriding the default SDK used by the DC client takes two steps. First, you need to enter the SDK directory location for a specific SDK (do this from the Project->Environment Settings->Process->Java home panel (NOTE : The SDK is referred to as JDK on this panel). Select the JDK level from the list box. Next, enter the directory associated with the JDK you select in the directory field. The example below defines a directory location for JDK 1.3
Figure 1. Specifying an SDK
Second, select the same SDK for the client-build process after you add the Database Connection to a project. From Project View, which is on the DB8A database alias,->Right Click->Properties->Java Build Settings. Next, specify the JDK release, (JDK 1.3) from the list box and click OK.
Figure 2. Selecting an SDK on a Database Connection
Run time of the Java stored procedure
The SDK you use at run time is determined by the JAVAENV DD statement in the WLM SPAS where the stored procedure executes. Specifically, the JAVA_HOME environment variable included in this DD statement determines the SDK that is selected. The base product of DB2 for OS/390 Version 7 includes support for the SDK 1.3.1. Support for the SDK 1.4.1 is provided in APAR PQ76769. The base product of DB2 for z/OS Version 8 includes support for both the SDK 1.3.1 and SDK 1.4.1. There is no support for SDK 1.3.0 or SDK 1.4.0 in either DB2 Version 7 or DB2 Version 8.
If you use SDK 1.4.1, the XPLINK(ON) parameter is required in the JAVAENV DD statement. If the XPLINK(ON) parameter is included when you specify a SDK 1.3.1, the following information message is written to the WLM SPAS.
CEE3611I The run-time option XPLINK= was an invalid run time option or is not supported
in this release of Language Environment. |
When the XPLINK(ON) parameter is not included in a JAVAENV DD statement that specifies SDK 1.4.1, the WLM SPAS will not initialize and the following error message will be included in the WLM SPAS joblog.
+DSNX961I DSNX9WLJ ATTEMPT TO PERFORM JNI FUNCTION CreateJavaVM 421
FAILED FOR STORED PROCEDURE . . SSN= DB8A PROC= DB8AJAV1 ASID=
008E CLASS= METHOD= ERROR INFO= DSNX9WLS ESTAE ENTERED |
If JSPDEBUG is turned on in the same
JAVAENV DD statement, the following type of information will be included indicating that a call was made from a NOXPLINK-compiled application to an XPLINK-compiled exported function in DLL libjvm.so and the XPLINK(ON) run time option was not specified.
CEE3501S The module libjvm.so was not found.
From entry point initjvm at compile unit offset +000014A0 at entry off |
Run time JAVAENV DD statement examples
The following examples apply to Java stored procedures using the Legacy Java Database Connectivity (JDBC)-driver.
SDK 1.3.1
ENVAR("DB2_HOME=/usr/lpp/db2/db2710",
"JAVA_HOME=/usr/lpp/java/IBM/J1.3",
"DB2SQLJPROPERTIES=/u/DB7PU/db2sqljjdbc.properties"),
MSGFILE(JSPDEBUG,,,,ENQ) |
SDK 1.4.1
XPLINK(ON),
ENVAR("DB2_HOME=/usr/lpp/db2/db2710",
"JAVA_HOME=/usr/lpp/java/IBM/J1.4",
"DB2SQLJPROPERTIES=/u/DB7PU/db2sqljjdbc.properties"),
MSGFILE(JSPDEBUG,,,,ENQ)
|
The following examples apply to Java stored procedures using the Universal JDBC driver
SDK 1.3.1
ENVAR("JCC_HOME=/usr/lpp/db2/db2810/jcc",
"JAVA_HOME=/usr/lpp/java/IBM/J1.3"),
MSGFILE(JSPDEBUG,,,,ENQ) |
SDK 1.4.1
XPLINK(ON),
ENVAR("JCC_HOME=/usr/lpp/db2/db2810/jcc",
"JAVA_HOME=/usr/lpp/java/IBM/J1.4"),
MSGFILE(JSPDEBUG,,,,ENQ) |
Notes:
Resources
- See SC18-7414, Application Programming Guide and Reference for Java, for more information on information on SDKs,
JAVAENV DD statement options, and the Legacy JDBC driver (described under JDBC/SQLJ Driver for OS/390) and the Universal JDBC Driver.
- The IBM Redbook DB2 for z/OS Stored Procedures: Through the CALL and Beyond, manual number SG24-7083, includes several sections with information related to this article.
About the author  | 
|  | Peggy Rader is an IBM senior software engineer in DB2 AD Tooling Test and Build at IBM's Silicon Valley Lab in San Jose, Calif. She presents and demonstrates the integration of IBM's Windows-based development tools for z/OS and Windows environments, including the DB2 Development Center, and WebSphere Studio Application Developer, to users internationally. Peggy can be reached at peggyr@us.ibm.com |
Rate this page
|  |