SQL/MX 3.2 Guide to Stored Procedures in Java (H06.25+, J06.14+)
Getting Started
HP NonStop SQL/MX Release 3.2 Guide to Stored Procedures in Java—691166-001
2-9
JVM Startup Options for Each SPJ Caller
For example, this CONTROL QUERY DEFAULT statement in an embedded SQL
program in C sets application-specific system properties for the SPJ environment of
the dynamically prepared CALL statement named sqlstmt1:
/* Build CALL statements in char buffers. */
strcpy(hv_sql_stmt1, "CALL samdbcat.sales.monthlyorders(?,?)");
/* IN, OUT */
strcpy(hv_sql_stmt2, "CALL samdbcat.persnl.adjustsalary(?,?,?)"
/* IN, IN, OUT */
for (i = 1; i <= 3; i++)
{
/* Set application-specific system properties for
/* the SPJ environment. */
strcpy(hv_ctrl_stmt, "CONTROL QUERY DEFAULT UDR_JAVA_OPTIONS '");
printf("\nEnter JVM startup options: ");
gets(attrval);
strcat(hv_crtl_stmt, attrval);
strcat(hv_ctrl_stmt, "'");
/* Prepare and execute the CONTROL QUERY DEFAULT statement. */
EXEC SQL EXECUTE IMMEDIATE :hv_ctrl_stmt;
/* Prepare a CALL statement. */
EXEC SQL PREPARE sqlstmt1 FROM :hv_sql_stmt1;
printf("\nEnter a number for the month: ");
scanf("%d", &hv_month_param1);
/* Call the stored procedure. */
EXEC SQL EXECUTE sqlstmt1
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










