SQLJ.INSTALL_JAR

The SQLJ.INSTALL_JAR stored procedure installs a JAR file into the database system. This JAR file can be used in subsequent CREATE FUNCTION and CREATE PROCEDURE statements.

Authorization

The privilege held by the authorization ID of the CALL statement must include at least one of the following for the SYSJAROBJECTS and SYSJARCONTENTS catalog tables:

  • The following system authorities:
    • The INSERT and SELECT privileges on the table
    • The system authority *EXECUTE on library QSYS2
  • Administrative authority

The privilege held by the authorization ID of the CALL statement must also have the following authorities:

  • Read (*R) access to the JAR file specified in the jar-url parameter being installed.
  • Write, Execute, and Read (*RWX) access to the directory where the JAR file is installed. This directory is /QIBM/UserData/OS400/SQLLib/Function/jar/schema, where schema is the schema of the jar-id.

Adopted authority cannot be used for these authorities.

SQL syntax

     >>-CALL--SQLJ.INSTALL_JAR-- (--'jar-url'--,--'jar-id'--,--deploy--)-->
 
     >--------------------------------------------------------------><

Description

jar-url
The URL containing the JAR file to be installed or replaced. The only URL scheme supported is 'file:'.
jar-id
The JAR identifier in the database to be associated with the file specified by the jar-url. The jar-id uses SQL naming and the JAR file is installed in the schema or library specified by the implicit or explicit qualifier. The implicit qualifier is the run-time authorization identifier.
deploy
Value used to describe the install_action of the deployment descriptor file. If this integer is a nonzero value, then the install_actions of a deployment descriptor file should be run at the end of the install_jar procedure. The current version of Db2® for i only supports a value of zero.

Usage notes

When a JAR file is installed, Db2 for i registers the JAR file in the SYSJAROBJECTS system catalog. It also extracts the names of the Java™ class files from the JAR file and registers each class in the SYSJARCONTENTS system catalog. Db2 for i copies the JAR file to a jar/schema subdirectory of the /QIBM/UserData/OS400/SQLLib/Function directory. Db2 for i gives the new copy of the JAR file the name given in the jar-id clause. A JAR file that has been installed by Db2 for i into a subdirectory of /QIBM/UserData/OS400/SQLLib/Function/jar should not be changed. Instead, the CALL SQLJ.REMOVE_JAR and CALL SQLJ.REPLACE_JAR SQL commands should be used to remove or replace an installed JAR file.

Example

The following command is issued from an SQL interactive session.

     CALL SQLJ.INSTALL_JAR('file:/home/db2inst/classes/Proc.jar' , 'myproc_jar', 0)

The Proc.jar file located in the file:/home/db2inst/classes/ directory is installed into Db2 for i with the name myproc_jar. Subsequent SQL commands that use the Procedure.jar file refer to it with the name myproc_jar.