Definition Of A Jar File For A Java Routine To Db2 - IBM DB2 Manual

Table of Contents

Advertisement

Example: Defining a Java user-defined function: Suppose that you have written and
prepared a user-defined function that has these characteristics:
Fully-qualified function name
Input parameter
Data type of returned value
Language
Collection ID for the function package
Package, class, and method name
Java data type of the method input
parameter
JAR file that contains the function class
Type of SQL statements in the program
Function is called when input parameter is
null?
WLM environment name
This CREATE FUNCTION statement defines the user-defined function to DB2:
CREATE FUNCTION MYSCHEMA.S2SAL(INTEGER)
In this function definition, you need to specify a method signature in the
EXTERNAL NAME clause because the data type of the method input parameter is
different from the default Java data type for an SQL type of INTEGER.

Definition of a JAR file for a Java routine to DB2

One way to organize the classes for a Java routine is to collect those classes into a
JAR file. If you do this, you need to install the JAR file into the DB2 catalog.
DB2 provides built-in stored procedures that perform the following functions for
the JAR file:
SQLJ.INSTALL_JAR
168
Application Programming Guide and Reference for Java
WLM ENVIRONMENT WLMIJAV
DYNAMIC RESULT SETS 1
PROGRAM TYPE SUB
PARAMETER STYLE JAVA;
RETURNS VARCHAR(20)
FENCED
MODIFIES SQL DATA
COLLID DSNJDBC
LANGUAGE JAVA
EXTERNAL NAME 'sal_JAR:s2.S2Sal.getSals(java.lang.Integer)'
WLM ENVIRONMENT WLMIJAV
CALLED ON NULL INPUT
PROGRAM TYPE SUB
PARAMETER STYLE JAVA;
Related concepts
"Definition of a JAR file for a Java routine to DB2"
Related reference
"ALTER FUNCTION" (DB2 SQL Reference)
"ALTER PROCEDURE" (DB2 SQL Reference)
"CREATE FUNCTION" (DB2 SQL Reference)
"CREATE PROCEDURE" (DB2 SQL Reference)
Installs a JAR file into the local DB2 catalog.
MYSCHEMA.S2SAL
INTEGER
VARCHAR(20)
Java
DSNJDBC
s2.S2Sal.getSals
java.lang.Integer
sal_JAR
Statements that modify DB2 tables
Yes
WLMIJAV

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents