SQL/MX 3.2.1 Guide to Stored Procedures in Java (H06.26+, J06.15+)
path1 and path2 are paths to JAR files or top-level directories where Java classes or package
directories exist. The paths must not include the package name.
For example, this command sets the class path for SPJs invoked from embedded SQL programs in
C, C++, or COBOL that will run in the current Guardian session:
PARAM CLASSPATH /usr/otherapps/myJar.jar:/usr/otherclasses
For more information about the PARAM command, see the TACL Reference Manual.
Setting the JVM extensions location
JRE supports the use of optional packages through its "extension mechanism". An optional package,
also known as JVM extensions, is a group of packages combined in one or more JAR files. These
JAR files implement an API that extends the Java platform. The virtual machine can find and load
optional package classes without them being on the class path.
Java platform extensions are typically located in $JREHOME/lib/ext. If the optional packages
are not present in this standard location, then include the location of the optional packages that
are referred by the core Java API using the UDR extensions class path. SQL/MX UDR server uses
the UDR extensions class path to search for JVM extensions.
NOTE: The class path 'java.class.path' cannot be used for setting the location of optional
packages.
Setting the JVM extensions location by Using UDR_JAVA_OPITIONS
Use the UDR_JAVA_OPTIONS default attribute to set the UDR extensions location in an SPJ
environment for an application or for all processes running on the node.
'-Dsqlmx.udr.extensions=jvm-extensions-path'
The jvm-extensions-path is the JAR file path of the optional extension package.
Installing JAR Files in NonStop SQL/MX
NonStop SQL/MX supports SPJ methods that are packaged in JAR files but does not support the
INSTALL_JAR, REMOVE_JAR, REPLACE_JAR, and ALTER_JAR_PATH procedures from SQL/JRT of
the ANSI SQL/Foundation standard.
To use a Java method in a JAR file as the body of an SPJ:
1. Place the JAR file in an OSS directory where you want to register the SPJ.
For example, this OSS command copies the myJar.jar file from a private location of
/usr/myfiles to the public location of /usr/spjfiles:
cp /E/DEV/usr/mydir/myJar.jar \
/E/PROD/usr/spjfiles/myJar.jar
2. Issue a CREATE PROCEDURE statement to register the SPJ, using the full OSS path of the JAR
file in the EXTERNAL PATH clause:
CREATE PROCEDURE samdbcat.sales.lowerprice()
EXTERNAL NAME 'pkg.subpkg.Sales.lowerPrice'
EXTERNAL PATH '/usr/spjfiles/myJar.jar'
...
For more information, see Creating an SPJ (page 59).
Establishing Java Security
Java has built-in security features, such as the Java security manager, that protect against
unauthorized use of or access to the system. With Java security enabled, the Java security manager
protects the SPJ environment by restricting access to system resources.
46 Getting Started










