SQL/MX Programming Manual for Java
SQLJ Programming
HP NonStop SQL/MX Programming Manual for Java—523726-003
3-19
Explicit Connection Contexts
The previous example queries the SQL/MX sample database. For more information,
see the entity-relationship diagram in the SQL/MX Reference Manual.
Customizing Each Profile With Different Options
When you process the SQLJ program, the SQLJ translator program generates
separate profiles (and modules) for the database objects that are associated with each
connection context class. For example, all SQL statements associated with the ctx1
connection context are stored in the MyProg_SJProfile0.ser profile, all statements
associated with ctx2 are stored in MyProg_SJProfile1.ser, and all statements
associated with ctx3 are stored in MyProg_SJProfile2.ser.
You can customize each profile individually with different catalog, schema, and module
naming options. For example, use the -schema option on the command line or in a
properties file to specify a different schema for the database objects in each profile:
java sqlj.tools.Sqlj -schema=samdbcat.sales
MyProg_SJProfile0.ser
java sqlj.tools.Sqlj -schema=samdbcat.persnl
MyProg_SJProfile1.ser
java sqlj.tools.Sqlj -schema=samdbcat.invent
MyProg_SJProfile2.ser
For more information, see the SQLJ Translator Command Line on page 5-10.
This technique enables you to process each set of database objects differently without
changing the source code of the program. As a result, you can deploy applications
from development to production, where the catalog and schema names might be
different. For more information, see the SQL/MX Installation and Management Guide. It
is also useful for developing applications for an RDF environment, where the catalog
names are different on the primary and backup nodes. For more information, see RDF
Considerations on page 4-24.