IBM DB2 Manual page 206

Table of Contents

Advertisement

4. Call the INSTALL_JAR stored procedure, which is on DB2 for z/OS, to define
5. If the installed JAR references classes in other installed JARs, call the
6. If another user defines the routine to DB2, on DB2 for z/OS, execute the SQL
7. On DB2 for z/OS, execute the SQL CREATE PROCEDURE statement to define
8. On DB2 for z/OS, execute the SQL GRANT EXECUTE statement to grant the
Preparing Java routines with SQLJ clauses and no JAR file
The program preparation process for Java routines that contain SQLJ clauses and
do not run from a JAR file includes translating and compiling the program,
customizing the serialized profiles, defining the routine to DB2, and granting the
appropriate privileges.
190
Application Programming Guide and Reference for Java
s1sal.jar
the JAR file to DB2.
You need to execute the CALL statement from a static SQL program or from an
ODBC or JDBC program. The CALL statement looks similar to this:
CALL SQLJ.INSTALL_JAR('file:/u/db2res3/s1sal.jar','MYSCHEMA.S1SAL',0);
The exact form of the CALL statement depends on the language of the program
that issues the CALL statement.
After this process completes, the DB2 catalog contains JAR file
MYSCHEMA.S1SAL.
SQLJ.ALTER_JAVA_PATH stored procedure, which is on DB2 for z/OS, to
specify the class resolution path that the JVM searches to resolve those class
references. You need to execute the CALL statement from a static SQL program
or from an ODBC or JDBC program.
GRANT USAGE ON JAR statement to grant the privilege to use the JAR file to
that user.
Suppose that you want any user to be able to define the stored procedure to
DB2. This means that all users need the USAGE privilege on JAR
MYSCHEMA.S1SAL. To grant this privilege, execute this SQL statement:
GRANT USAGE ON JAR MYSCHEMA.S1SAL TO PUBLIC;
the stored procedure to DB2:
CREATE PROCEDURE SYSPROC.S1SAL
(DECIMAL(10,2) INOUT)
FENCED
MODIFIES SQL DATA
COLLID ADMCOLL
LANGUAGE JAVA
EXTERNAL NAME 'MYSCHEMA.S1SAL:s1.S1Sal.getSals'
WLM ENVIRONMENT WLMIJAV
DYNAMIC RESULT SETS 1
PROGRAM TYPE SUB
PARAMETER STYLE JAVA;
privilege to run the routine to that user.
Suppose that you want any user to be able to run the routine. This means that
all users need the EXECUTE privilege on SYSPROC.S1SAL. To grant this
privilege, execute this SQL statement:
GRANT EXECUTE ON PROCEDURE SYSPROC.S1SAL TO PUBLIC;
Related concepts
"Definition of a JAR file for a Java routine to DB2" on page 168
Related tasks
"Program preparation for SQLJ programs" on page 183
"Creating JAR files for Java routines" on page 191

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents