SQL/MX Programming Manual for Java

Introduction
HP NonStop SQL/MX Programming Manual for Java523726-003
1-22
Execution Scenarios
Execution Scenarios
After translating and customizing an SQLJ program, you have several options for
executing it. Because SQLJ programs are Java programs, you have the same options
for executing them as you do for other NonStop Java applications.
Stand-Alone Execution
You can run an SQLJ program from the OSS command line. To do so, the SQLJ
program must contain the main() method with this signature:
public static void main(String [] args)
The main() method executes when you use the java command to invoke the JVM.
To execute an SQLJ program, run the program class file (for example, MyProg) from
the SQLJ run-time command line. For example, this command executes the
MyProg.class file:
java MyProg
For more information, see SQLJ Run-Time Command Line on page 5-41.
To execute an SQLJ application packaged as a JAR file (for example, MyApp.jar),
use this command:
java -jar MyApp
For this command to work, you must specify the name of the class file for Main-
Class in the manifest header. For more information, see Packaging the Program in a
JAR File on page 6-5.
Stored Procedure in Java (SPJ)
You can register a method in an SQLJ program as a stored procedure in Java (SPJ).
To invoke an SQLJ-based SPJ in SQL/MX, issue a CALL statement from any of these
applications or interfaces:
SQL/MX conversational interface (MXCI)
Embedded SQL program in C or COBOL
SQLJ program
HP NonStop ODBC/MX
HP NonStop JDBC/MX
For more information, see the SQL/MX Guide to Stored Procedures in Java.