SQL/MX Programming Manual for Java

Introduction
HP NonStop SQL/MX Programming Manual for Java523726-003
1-20
Executing an SQLJ Program
Executing an SQLJ Program
When you execute an SQLJ program, the program class file (for example,
MyProg.class) runs like any Java program except that it calls the SQLJ run time to
execute the embedded SQL/MX statements. The SQLJ run time connects to an
SQL/MX database by means of a JDBC connection.
When an SQLJ program executes, the JVM searches the directories and JAR files
specified by the class path and loads the classes necessary to run the application,
such as one or more JAR or class files for the application and the supporting JAR files
for the SQLJ run-time library (RTL), the JDBC/MX driver, and the Java library. When
the JVM encounters an SQL statement in the program class file, an SQLJ RTL routine
loads the extended profile. Information in the extended profile causes the SQLJ RTL to
make JDBC calls to load and execute the statement plan from the module.
Static SQLJ Execution
The SQLJ run time first tries to load each statically compiled SQL statement from the
module. This process is called the customized run time. Figure 1-4 shows the static
SQLJ execution environment.
Figure 1-4. Static SQLJ Execution Environment
VST003.vsd
JVM
JDBC/MX
MyProg
SQLJ Run Time
Keys File
MyProg_SJProfile
Keys.class
Iterator Class
MyProg$Iter.
class
Connection
Context Class
SQLMXCtx.class
Java Class File
of the SQLJ Program
MyProg.class
Extended Profile
MyProg_SJProfile0.ser
Module
CAT.SCH.GRP1^MOD1^
TABLESET1^VER1
/usr/tandem/sqlmx/USERMODULES
directory
JAR File of the
SQLJ Application
MyApp.jar
SQL/MX
JDBC/MX