Granting privileges for using JAR files

To use Java™ archive (JAR) files, you need to have the USAGE privilege on the JAR.

About this task

If you have the USAGE privilege on the JAR, you can specify a JAR file in the EXTERNAL NAME clause of a stored procedure with a language type of Java.

Procedure

To grant privileges for using JAR files:

Issue the GRANT statement, specifying the USAGE clause.
For example, assume that you want the user whose AUTHID is PAOLORW to create a Java stored procedure, EMPDTL1J. Assume that the external name of the stored procedure is to be DEVL7083.EmpJar:EmpDtl1J.GetEmpDtls, where:
DEVL7083.EmpJar
Is the JAR file name.
EmpDtl1J
Is the class name.
GetEmpDtls
Is the method name.
AUTHID PAOLORW needs the USAGE privilege (from the JAR file owner ID or schema that was used for executing the INSTALL_JAR stored procedure). The following statement grants this privilege:

Begin general-use programming interface information.

GRANT USAGE ON JAR DEVL7083.EmpJar TO PAOLORW;
End general-use programming interface information.

In addition, if specified, the contents of the JAR file must already be installed in the Db2 catalog at the time the stored procedure is created.