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-13
JVM Startup Options for Each SPJ Caller
EXEC SQL CONTROL QUERY DEFAULT UDR_JAVA_OPTIONS '-Xmx32M';
/* Call the stored procedure. */
EXEC SQL CALL samdbcat.sales.lowerprice();
/* Turn off the application-specific system properties for
/* the SPJ environment. */
EXEC SQL CONTROL QUERY DEFAULT UDR_JAVA_OPTIONS 'OFF';
/* Call the stored procedure. */
EXEC SQL CALL samdbcat.sales.lowerprice();
...
CALL statements that are statically compiled 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 static 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 Dynamically Compiled
Applications
The UDR_JAVA_OPTIONS setting in a dynamically executed CONTROL QUERY
DEFAULT statement affects CALL statements that are dynamically prepared after the
CONTROL QUERY DEFAULT statement has executed.
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