SQL/MX 3.2.1 Guide to Stored Procedures in Java (H06.26+, J06.15+)
Figure 3 Invoking an SPJ
1. An SQL/MX application invokes an SPJ by issuing a CALL statement. The SQL/MX executor
reads the compiled SQL plan for the CALL statement.
2. The SQL/MX executor checks the procedure label to verify that the caller has permission to
invoke the SPJ.
3. If the caller has permission to invoke the SPJ, the SQL/MX executor starts sending messages
to the SQL/MX UDR server (shown as the MXUDR executable in Figure 3) to execute the SPJ.
The SQL/MX executor sends any input parameters that the application passes to the SPJ to
the SQL/MX UDR server.
4. Inside the SQL/MX UDR server process, an SPJ class loader loads the class specified by the
SPJ and executes the SPJ method.
5. The SQL/MX UDR server returns the output parameters of the SPJ to the SQL/MX executor,
and the SQL/MX executor returns the output to the application. If exceptions occur during the
execution of the Java method, the SQL/MX UDR server returns them to the SQL/MX executor
as SQL diagnostics.
Invoking Different Types of SPJs
The next subsections show the layers of code within an SQL/MX UDR server process and how
these layers interact when an application issues CALL statements that invoke different types of SPJ
methods.
Pure Java Method
An SPJ can be based on a Java method from a pure Java program (that is, one that does not
contain JDBC/MX method calls or SQLJ statements). A pure Java method does not directly perform
database access operations. This type of SPJ method is loaded into the SPJ environment and
executes its application logic by referring to its own class, other application classes, and Java
system and extension classes:
SPJs in NonStop SQL/MX 23










