SQL/MX Programming Manual for Java

SQL/MX Programming Considerations
HP NonStop SQL/MX Programming Manual for Java523726-003
4-2
Static and Dynamic Execution Scenarios
If the SQLJ run time cannot load an SQL statement from the module, the SQLJ run
time typically calls JDBC to prepare and execute the statement dynamically. The SQLJ
standard refers to this dynamic process as the default run time.
The next subsections explain why the default run time might occur instead of the
customized run time.
Static and Dynamic Execution Scenarios
The execution behavior of an SQLJ program follows one of these scenarios:
If you do not customize an SQLJ program, or if customization fails, no module is
generated, and all SQL statements execute dynamically.
If you customize the SQLJ program and the module contains entries for each SQL
statement in the program, all SQL statements execute statically.
If you customize the SQLJ program and the module contains entries for some SQL
statements but not for others, the SQL statements that were customized (that is,
have entries in the module) execute statically, and the statements that were not
customized execute dynamically.
For information about customization, see Customization Without Module Definition
Files on page 1-13.
Causes of Dynamic Execution
Aside from SQLJ programs that you do not customize deliberately, embedded SQL
statements in SQLJ programs might execute dynamically for these reasons:
Missing or Unavailable Database Objects
Customization Errors
SQL/MX Compiler Errors
Missing or Unavailable Database Objects
If an SQL statement in an SQLJ clause refers to a table, view, stored procedure, or
other database object that does not exist at the time of customization, the customizer
cannot generate an entry of this statement in the module definition. As a result, the
SQL statement is not customized, running dynamically in the default run time.
Effect of the -missingSQLObject Option
You can set the -missingSQLObject option to true or false during translation or
customization. By default, this option is false. During customization, the setting of this
option determines if customization succeeds or fails when a referenced database
object is unavailable. See Figure 4-1 on page 4-3. For information about setting this
option, see Option for Missing or Unavailable Database Objects on page 5-23.