SQL/MX 3.2.1 Guide to Stored Procedures in Java (H06.26+, J06.15+)
SPJs in NonStop SQL/MX
This subsection explains the process and effect of registering and invoking SPJs in NonStop SQL/MX:
• Effect of Registering an SPJ (page 21)
• Effect of Invoking an SPJ (page 22)
• Invoking Different Types of SPJs (page 23)
Effect of Registering an SPJ
When you register an SPJ by using a CREATE PROCEDURE statement, NonStop SQL/MX verifies
that the specified Java method exists and that its signature matches the SQL parameters of the
stored procedure. After verifying the SPJ, NonStop SQL/MX stores information about the SPJ
method, such as its name, location, and parameter types, in the system metadata tables. After you
register an SPJ in NonStop SQL/MX, any SQL/MX application or interface with the appropriate
permissions can call the SPJ to execute the SPJ method.
Figure 2 shows how NonStop SQL/MX processes a CREATE PROCEDURE statement.
Figure 2 Registering an SPJ
1. The CREATE PROCEDURE statement that the application issues is processed by an SQL/MX
compiler (MXCMP) process.
2. The catalog manager within the MXCMP process invokes aninternal SPJ named VALIDAT
EROUTINE2, which is in SYSTEM_SQLJ_SCHEMA, and passes information from the CREATE
PROCEDURE statement to it.
3. VALIDATEROUTINE2 validates the Java class and method specified in the CREATE PROCEDURE
statement within an SQL/MX UDR server process (shown as the MXUDR executable in Figure 2).
VALIDATEROUTINE2 uses the embedded Java virtual machine (JVM) within the SQL/MX UDR
server process to verify that the Java method exists in the specified class and that its signature
maps to the SQL parameters specified in the CREATE PROCEDURE statement. If the method
exists and its signature maps to the SQL parameters, the SQL/MX UDR server returns a condition
indicating success to the MXCMP process. Otherwise, the SQL/MX UDR server returns an
error condition, and 4 do not complete.
SPJs in NonStop SQL/MX 21










