SQL/MX Programming Manual for Java
HP NonStop SQL/MX Programming Manual for Java—523726-003
4-1
4
SQL/MX Programming
Considerations
This section explains the behavior of various SQL statements in an SQLJ program and
covers these topics:
•
Static and Dynamic SQL on page 4-1
•
CONTROL Statements on page 4-6
•
SET TABLE TIMEOUT Statement on page 4-11
•
MODULE Directive on page 4-12
•
DECLARE and SET Statements for Object Name Qualification on page 4-16
•
Name Resolution on page 4-20
•
Similarity Checks and Automatic Recompilation on page 4-26
•
Data Definition Language (DDL) Statements on page 4-32
•
UPDATE STATISTICS Statement on page 4-39
•
Publish/Subscribe Services on page 4-40
•
Transaction Management on page 4-41
For basic SQLJ programming constructs, see Section 3, SQLJ Programming.
Static and Dynamic SQL
An SQLJ program supports static SQL statements in a Java program and yields the
performance benefits of statically compiled SQL. In an SQLJ program, you typically
embed SQL statements in SQLJ clauses for static SQL and use JDBC methods for
dynamic SQL. In this respect, static and dynamic constructs in an SQLJ program differ
from C and COBOL programs. Unlike C and COBOL programs, you cannot explicitly
code SQL statements in SQLJ clauses to behave dynamically.
SQL statements in SQLJ clauses are not intended to run dynamically. However, in
some cases, these embedded SQL statements execute dynamically through JDBC
instead of statically through a compiled SQL module during run time. SQLJ tries to
mask any differences in behavior between embedded SQL statements that run
statically and those that run dynamically. To develop an SQLJ program that exhibits the
intended static and dynamic behavior, you should know when embedded SQL
statements run dynamically and code and process a program accordingly.
Customized and Default Run Time
During the execution of an SQLJ program, the SQLJ run time first tries to load each
statically compiled SQL statement from the module. (For information about the module,
see Module on page 1-16.) The SQLJ standard refers to this process as the
customized run time.