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

Using Multiple UDR_JAVA_OPTIONS Settings in One Application............................................39
Setting the JREHOME Location.................................................................................................40
Setting JREHOME by Using UDR_JAVA_OPTIONS..................................................................40
Setting the JREHOME Environment Variable...........................................................................41
Setting the JDBC/MX Location..................................................................................................42
UDR Extensions Class Path..................................................................................................42
Setting the JDBC/MX Location by Using UDR_JAVA_OPTIONS................................................43
Setting the Class Path..............................................................................................................43
Setting the Class Path by Using UDR_JAVA_OPTIONS............................................................44
Setting the CLASSPATH Environment Variable........................................................................45
Setting the JVM extensions location...........................................................................................46
Setting the JVM extensions location by Using UDR_JAVA_OPITIONS.........................................46
Installing JAR Files in NonStop SQL/MX....................................................................................46
Establishing Java Security........................................................................................................46
Using UDR_JAVA_OPTIONS to Enable Java Security...............................................................47
SPJ Policy File and Required Permissions................................................................................47
3 Writing SPJ Methods.................................................................................49
Guidelines for Writing SPJ Methods..........................................................................................49
Signature of the Java Method..............................................................................................49
Returning Output Values From the Java Method......................................................................50
Using the main() Method....................................................................................................52
Null Input and Output........................................................................................................52
Static Java Variables..........................................................................................................52
Nested Java Method Invocations..........................................................................................53
Accessing SQL/MP and SQL/MX Databases.............................................................................53
Use of java.sql.Connection Objects......................................................................................53
JDBC/MX-Based Java Method.............................................................................................54
Referring to Database Objects in an SPJ Method....................................................................55
Exception Handling............................................................................................................56
Handling Java Exceptions........................................................................................................57
User-Defined Exceptions......................................................................................................57
Writing Data to a File or Terminal.............................................................................................57
Compiling Java Classes...........................................................................................................58
4 Registering SPJs in NonStop SQL/MX.........................................................59
Creating an SPJ......................................................................................................................59
Required Privileges for Creating an SPJ.................................................................................59
Effect of Creating an SPJ.....................................................................................................59
Using the CREATE PROCEDURE Statement.................................................................................59
Naming the Stored Procedure..............................................................................................60
Specifying SQL Parameters..................................................................................................61
Specifying the Maximum Number of Result Sets.....................................................................63
Specifying the SPJ Method..................................................................................................64
Specifying the External Path................................................................................................66
Naming the Procedure Label...............................................................................................66
Specifying an SQL Access Mode.........................................................................................67
Dropping an SPJ.....................................................................................................................67
Required Privileges for Dropping an SPJ................................................................................67
Effect of Dropping an SPJ....................................................................................................67
Using the DROP PROCEDURE Statement...............................................................................68
Altering an SPJ and Its Java Class.............................................................................................68
Changes to the External Path...............................................................................................68
Changes to the External Name............................................................................................69
Changes to the Java Signature............................................................................................70
4 Contents