SQL/MX 3.2.1 Guide to Stored Procedures in Java (H06.26+, J06.15+)

If more than one matching Java method exists, by default SQL/MX does not attempt to resolve the
ambiguity and an error is raised. This can happen when two or more methods in the specified
Java class have the same overloaded method name but differ only in the number of trailing
java.sql.ResultSet[ ] parameters. When a CREATE PROCEDURE statement can potentially map to
more than one Java method, users must provide a full Java method signature in the EXTERNAL
NAME clause to resolve the ambiguity.
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 (page 49).
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 (page 66).
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 (page 68).
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 3: Mapping of SQL/MX Data Types
to Java Data Types (page 62)
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 Java signature because the
SQL parameters (NUMERIC and FLOAT) map by default to the same Java data types
(java.math.BigDecimal and double) as the parameters of the underlying Java method:
EXTERNAL NAME 'Payroll.adjustSalary'
64 Registering SPJs in NonStop SQL/MX