SQL/MX Guide to Stored Procedures in Java (G06.24+, H06.03+)

Introduction
HP NonStop SQL/MX Guide to Stored Procedures in Java523727-004
1-17
Application Classes That an SPJ Can Access
Application Classes That an SPJ Can Access
A Java method that you register as an SPJ might need to access, either directly or
indirectly, other Java classes to operate properly, as shown in Figure 1-7.
To enable an SPJ method to refer to application classes, either put the application
classes in the same external path as the SPJ class or specify the locations of the
application classes in the class path.
Accessing Application Classes in the External Path
An SPJ method can access by default all application classes within its external path
location, which you specify in the EXTERNAL PATH clause of a CREATE
PROCEDURE statement when registering an SPJ. The external path is either an OSS
directory or a JAR file path that contains the SPJ class file. See Specifying the External
Path on page 4-9.
If the external path is an OSS directory, only class files in the specified directory (or
within packages in the specified directory) are considered to be in the external path.
JAR files within the specified directory are not considered to be part of the external
path.
If the external path is a JAR file path, only class files within the JAR file are considered
to be in the external path. For example, if an SPJ class named myClass is contained
in a JAR file named myJar.jar, the external path is the JAR file path,
/usr/myapps/myJar.jar. All classes stored in the same JAR file as myClass are
accessible by default to the SPJ method, myMethod().
Accessing Application Classes Outside the External Path
For an SPJ method to access an application class outside its external path, you must
set a search path in the SPJ environment called the class path. A class path can
contain multiple directories and JAR file paths, which an SPJ class loader uses to
search for referenced application classes.
Figure 1-7. Java Classes That an SPJ Can Access
VST006.vsd
Application Classes in the External Path
'/usr/myapps/myJar.jar'
Application Classes in the Class Path
/usr1/otherapps:/usr2/otherapps:...
System and Extension Classes
Java Class File: myClass.class
SPJ Method
EXTERNAL NAME:
'pkg.subpkg.myClass.myMethod()'
EXTERNAL PATH:
'/usr/myapps/myJar.jar'
Refers to...