Enterprise Edition Home | Express Edition Home | Previous Page | Next Page   SQL Statements > EXECUTE PROCEDURE >

sqlj.alter_java_path

Use sqlj.alter_java_path( ) to specify the jar-file path to use when the routine manager resolves related Java classes for the jar file of a UDR written in Java.

Read syntax diagramSkip visual syntax diagramsqlj.alter_java_path:
 
|--sqlj.alter_java_path----------------------------------------->
 
                            .-------------.
                   (1)      V             |                                (1)
>--(--| Jar Name |-------(----package_id.-+--+- *-------+--,--| Jar Name |-------))--|
                                             '-class_id-'
 

Notes:
  1. See Jar Name

Element Description Restrictions Syntax
class_id Java class that contains method to implement the UDR Java class must exist in the jar file that jar_id specifies. Identifier must not exceed 255 bytes. Language specific
package_id Name of the package that contains the Java class The fully qualified identifier of package_id.class_id must not exceed 255 bytes Language specific

The jar IDs that you specify, namely the jar ID for which you are altering the jar-file path and the resolution jar ID, must both have been installed with the sqlj.install_jar procedure. When you invoke a UDR written in the Java language, the routine manager attempts to load the Java class in which the UDR resides. At this time, it must resolve the references that this Java class makes to other Java classes.

The three types of such class references are these:

  1. References to Java classes that the JVPCLASSPATH configuration parameter specifies (such as Java system classes like java.util.Vector)
  2. References to classes that are in the same jar file as the UDR
  3. References to classes that are outside the jar file that contains the UDR.

The routine manager implicitly resolves classes of type 1 and 2 in the preceding list. To resolve type 3 references, it examines all the jar files in the jar file path that the latest call to sqlj.alter_java_path( ) specified.

The routine manager throws an exception if it cannot resolve a class reference. The routine manager checks the jar file path for class references after it performs the implicit type 1 and type 2 resolutions.

If you want a Java class to be loaded from the jar file that the jar file path specifies, make sure the Java class is not present in the JVPCLASSPATH configuration parameter. Otherwise, the system loader picks up that Java class first, which might result in a different class being loaded than what you expect.

Suppose that the sqlj.install_jar( ) procedure and CREATE FUNCTION have been executed as the preceding sections describe. The following SQL statement invokes sql_explosive_reaction( ) function in the course_jar jar file:

EXECUTE PROCEDURE alter_java_path("course_jar", 
   "(professor/*, prof_jar)");
EXECUTE FUNCTION sql_explosive_reaction(10000)

The routine manager attempts to load the class Chemistry. It uses the path that the call to sqlj.alter_java_path( ) specifies to resolve any class references. Therefore, it checks the classes that are in the professor package of the jar file that prof_jar identifies.

Enterprise Edition Home | Express Edition Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]