SQL/MX Programming Manual for Java

SQL/MX Programming Considerations
HP NonStop SQL/MX Programming Manual for Java523726-003
4-13
Connection Context of the MODULE Directive
Connection Context of the MODULE Directive
Specify only one MODULE directive per connection context. Otherwise, the SQLJ
translator generates an error. For example, this code is disallowed and returns an
error:
#sql [ctx1, exCtx1] {MODULE cat.sch.mod NAMES ARE ISO88591};
#sql [ctx1, exCtx2] {MODULE catlg.schm.modl};
You can specify an execution context for the MODULE directive, but SQLJ ignores it.
Do not forget to specify a MODULE directive for SQL statements associated with the
default, or implicit, connection context. For example, this MODULE directive names the
module for the SELECT statement and other statements that are not associated with
an explicit connection context:
#sql {MODULE cat.sch.mod NAMES ARE ISO88591};
#sql {SELECT last_name
INTO :empname
FROM employee
WHERE empnum = 65
};
If you do not specify a MODULE directive for the implicit connection context, the
customizer uses a system-defined module name. For more information, see System-
Defined Module Name on page 4-15.
Catalog and Schema of the Module Name
You can optionally qualify the module name by specifying the catalog and schema or
by specifying only the schema. If you do not specify a catalog or schema for the
module name in the MODULE directive, the SQLJ customizer determines the
qualification based on these settings in order of precedence, from highest to lowest:
1. SQLJ command-line options, -moduleCatalog and -moduleSchema (if you
specify only the schema), on the SQLJ command line or in a properties file
2. SQLJ command-line option, -moduleSchema (if you specify both the catalog and
schema), on the SQLJ command line or in a properties file
3. SQLJ command-line options, -catalog and -schema, on the SQLJ command
line or in a properties file
4. Default CATALOG and SCHEMA in the SYSTEM_DEFAULTS table
5. User group (catalog) and user name (schema) of the current user
For more information about the SQLJ command-line options, see SQLJ Translator
Command Line on page 5-10. For more information about the SYSTEM_DEFAULTS
table, see the SQL/MX Reference Manual.