Preparation Of Java Routines With Sqlj Clauses - IBM DB2 Manual

Table of Contents

Advertisement

Preparing Java routines with no SQLJ clauses and no JAR file
The program preparation process for Java routines that contain no SQLJ clauses
and do not run from a JAR file includes compiling the program, defining the
routine to DB2, and granting the appropriate privileges.
The steps in the process are:
1. Run the javac command to compile the Java program to produce Java
2. Ensure that the zFS or HFS directory that contains the class files for your
3. Execute the SQL CREATE PROCEDURE or CREATE FUNCTION statement to
4. Execute the SQL GRANT statement to grant the EXECUTE privilege on the

Preparation of Java routines with SQLJ clauses

There are three methods for preparing Java routines with SQLJ clauses.
Those methods are:
v Prepare the routine Java routine to run from a JAR file. Running Java routines
v Prepare the routine Java routine with no JAR file.
v Use IBM Data Studio to prepare the routine.
Preparing Java routines with SQLJ clauses to run from a JAR
file
The recommended method of running Java routines is to run them from a JAR file.
The program preparation process for Java routines that contain SQLJ statements
and run from a JAR file includes translating and compiling the program,
customizing the serialized profiles, creating the JAR file, defining the JAR file and
the routine to DB2, and granting the appropriate privileges.
The steps in the process are:
1. Run the sqlj command to translate the source code to produce generated Java
188
Application Programming Guide and Reference for Java
"Definition of a JAR file for a Java routine to DB2" on page 168
Related tasks
"Creating JAR files for Java routines" on page 191
bytecodes.
routine is in the CLASSPATH for the WLM-established stored procedure
address space.
You specify this CLASSPATH in the JAVAENV data set. You specify the
JAVAENV data set using a JAVAENV DD statement in the startup procedure
for the WLM-established stored procedure address space.
If you need to modify the CLASSPATH environment variable in the JAVAENV
data set to include the directory for the Java routine's classes, you must restart
the WLM address space to make it use the modified CLASSPATH.
define the routine to DB2. Specify the EXTERNAL NAME parameter without a
JAR name.
routine to the appropriate users.
Related concepts
"Program preparation for JDBC programs" on page 183
"Run-time environment for Java routines" on page 160
from JAR files is recommended.
You can use this method regardless of whether the routine is in a JAR file.
source code and serialized profiles, and to compile the Java program to
produce Java bytecodes.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents