SQL/MX Programming Manual for Java

Sample Programs
HP NonStop SQL/MX Programming Manual for Java523726-003
C-8
Translating the Program
Translating the Program
At an OSS prompt, enter this command to translate the SQLJ source file by running
the SQLJ translator:
java sqlj.tools.Sqlj -createMDF SampleDDL.sqlj
Running the Program
At an OSS prompt, enter this command to run the SQLJ program:
java SampleDDL
Results of Running the Program
This output is returned to the screen when you run the SQLJ program:
/* Set the default catalog and schema for a set of
* database objects to be created. */
// #sql [ctx3] {DECLARE CATALOG 'SAMDBCAT2'};
// #sql [ctx3] {DECLARE SCHEMA 'INVENT2'};
// Create tables in the schema
// #sql [ctx3] {CREATE TABLE...};
// System.out.println("The ... table was created.");
// #sql [ctx3] {CREATE TABLE...};
// System.out.println("The ... table was created.");
// #sql [ctx3] {CREATE TABLE...};
// System.out.println("The ... table was created.");
} // End of doTABLES() method
} // End of SampleDDL class
The SAMDBCAT2 catalog was created.
The PERSNL2 schema was created.
The SALES2 schema was created.
The INVENT2 schema was created.
The EMPLOYEE_INTERNATL table was created.
A constraint was added to the EMPLOYEE_INTERNATL table.
Indexes were created on the EMPLOYEE_INTERNATL table.
The EMPLIST_INTERNATL view was created.
The DEPT_INTERNATL table was created.
Constraints were added to the DEPT_INTERNATL table.
Indexes were created on the DEPT_INTERNATL table.
The MGRLIST_INTERNATL view was created.
The JOB_INTERNATL table was created.
The PROJECT_INTERNATL table was created.
Example C-1. SampleDDL.sqlj—Creating Tables From an SQLJ
Program (page 7 of 7)