SQL/MX 3.2 Guide to Stored Procedures in Java (H06.25+, J06.14+)

Registering SPJs in NonStop SQL/MX
HP NonStop SQL/MX Release 3.2 Guide to Stored Procedures in Java691166-001
4-8
Specifying the SPJ Method
Specifying the SPJ Method
Specify the external Java method to be used as the SPJ method in the EXTERNAL
NAME clause, as shown:
The Java method that you specify in the EXTERNAL NAME clause must be defined as
public and static and have a return type of void. For more information, see
Guidelines for Writing SPJ Methods on page 3-1.
NonStop SQL/MX does not allow JAR file names to be specified in the EXTERNAL
NAME clause. Instead, use the EXTERNAL PATH clause to specify the location of a
JAR file that contains the Java class. See Specifying the External Path on page 4-10.
Java Method Name
The Java method name consists of the case-sensitive names of the method and the
Java class that contains the method. For example, the Java method named
adjustSalary() is prefixed with the name of its class, Payroll:
'Payroll.adjustSalary'
If the class is stored in a package, you must also specify the package name. In this
example, the package and subpackage names of the class file are pkg.subpkg:
'pkg.subpkg.Payroll.adjustSalary'
If you do not specify the class name and package, if it exists, in the EXTERNAL NAME
clause, the CREATE PROCEDURE statement fails to register the SPJ.
Java Method Signature
Specifying the Java signature is necessary only when an SQL parameter of the SPJ
does not map by default to a Java wrapper class and when the SPJ method uses a
Java wrapper class instead of a Java primitive data type in its Java signature. See
Table 4-1, Mapping of SQL/MX Data Types to Java Data Types, on page 4-6.
Usually, if you do not specify the Java signature, the SQL data types map by default to
the correct Java data types. For example, this EXTERNAL NAME clause omits the
Caution. NonStop SQL/MX does not maintain the Java class file that contains the SPJ
method. NonStop SQL/MX records only a reference to the location of the Java class file in
system metadata. Subsequent changes to the Java class file after you register the SPJ might
result in run-time errors when you try to execute the SPJ. For guidelines on how to alter an
SPJ, see Altering an SPJ and Its Java Class
on page 4-14.
VST019.vsd
EXTERNAL NAME 'Payroll.adjustSalary'
Class Name
Method Name