SQL/MX Guide to Stored Procedures in Java (G06.24+, H06.03+)

Getting Started
HP NonStop SQL/MX Guide to Stored Procedures in Java523727-004
2-14
JVM Startup Options for Each SPJ Caller
USING :hv_month_param1 /* IN */
INTO :hv_ordernum_param2; /* OUT */
printf("\nThe number of orders during that month is %d.\n");
/* Turn off the application-specific system properties for
/* the SPJ environment. */
strcpy(hv_ctrl_stmt, "CONTROL QUERY DEFAULT UDR_JAVA_OPTIONS 'OFF'");
}
/* Prepare another CALL statement. */
EXEC SQL PREPARE sqlstmt2 FROM :hv_sql_stmt2;
...
/* Call the stored procedure. */
EXEC SQL EXECUTE sqlstmt2
USING :hv_empnum_param1, :hv_percent_param2 /* IN, IN */
INTO :hv_newsalary_param3; /* OUT */
Dynamic CALL statements that are prepared outside of the loop, after the CONTROL
QUERY DEFAULT statement turns off the UDR_JAVA_OPTIONS setting, execute in
an SPJ environment without application-specific startup options.
For more information about the semantics of dynamic CONTROL statements in
embedded SQL programs, see the SQL/MX Programming Manual for C and COBOL
or the SQL/MX Programming Manual for Java.
Scope of JVM Startup Options in an MXCI Session
During an MXCI session, you can issue a CONTROL QUERY DEFAULT statement
that sets the UDR_JAVA_OPTIONS default attribute. This setting applies only to CALL
statements that you issue in MXCI after you issue the CONTROL QUERY DEFAULT
statement.
For example, the first CONTROL QUERY DEFAULT statement sets the class path for
the SPJ environment of subsequent CALL statements that you issue in MXCI. When
you call the LOWERPRICE procedure after issuing the CONTROL QUERY DEFAULT
statement, the JVM uses the /usr/otherclasses class path to search for and load
classes that are not in the external path of that SPJ. The second CONTROL QUERY
DEFAULT statement resets the UDR_JAVA_OPTIONS setting to the class path in
effect, if any, at the start of the current MXCI session:
>>CALL samdbcat.sales.monthlyorders(1,?);
NUMBER
-----------
1
--- SQL operation complete.
>>CONTROL QUERY DEFAULT UDR_JAVA_OPTIONS
'-Djava.class.path=/usr/myclasses';
--- SQL operation complete.
>>CALL samdbcat.sales.lowerprice();