SQL/MX Programming Manual for Java

Sample Programs
HP NonStop SQL/MX Programming Manual for Java523726-003
C-2
SampleDDL.sqlj—Creating Tables From an SQLJ
Program
SQL/MX Release 1.8 sample database. To query SQL/MX tables, use the SQL/MX
Release 2.x sample database.
To install the sample database, see the SQL/MX Quick Start. For information about the
schema and tables of the sample database, see the SQL/MX Reference Manual. For
information about the schema and tables of the shipping database (for the
publish/subscribe programs), see the SQL/MX Queuing and Publish/Subscribe
Services manual.
SampleDDL.sqlj—Creating Tables From an
SQLJ Program
The SampleDDL program creates SQL/MX catalogs, schemas, and database objects.
The SQL/MX tables generated by this program are similar to tables in the SQL/MX
sample database, except that they have character string columns in UCS2 (Unicode)
format. Unicode supports characters of many different languages. For more
information, see Character Sets on page 3-40 and Data Definition Language (DDL)
Statements on page 4-32.
To install the sample database, see the SQL/MX Quick Start.
SQLJ Source File
Note. The SQL/MX Release 2.x sample database uses SQL/MX format tables. To install the
sample database, you must have a license to use SQL/MX DDL statements. To acquire this
license, purchase product T0394. Without this product, you cannot install the sample database.
An error message informs you that the system is not licensed.
Note. To create SQL/MX database objects, you must have a license to use SQL/MX DDL
statements. To acquire this license, purchase product T0394. If you do not purchase this
product and you try to process and run this program, an error message informs you that the
system is not licensed.
Example C-1. SampleDDL.sqlj—Creating Tables From an SQLJ
Program (page 1 of 7)
import java.sql.*;
import sqlj.runtime.*;
// Declare ConnectionContext classes
#sql context DefConCtx1;
#sql context DefConCtx2;
#sql context DefConCtx3;
public class SampleDDL {
private DefConCtx1 ctx1 = null; // Declares and initializes
// connection contexts
private DefConCtx2 ctx2 = null;
private DefConCtx3 ctx3 = null;