SQL/MX Programming Manual for Java

HP NonStop SQL/MX Programming Manual for Java523726-003
C-1
C Sample Programs
This appendix presents sample programs that demonstrate basic SQLJ concepts, DDL
and DML operations, multithreading, and publish/subscribe functionality. These
programs include:
SampleDDL.sqlj—Creating Tables From an SQLJ Program on page C-2
SampleDML.sqlj—Inserting, Deleting, Updating, and Selecting Data on page C-9
MultiThread1.sqlj—Threads With Explicit Execution Contexts on page C-13
MultiThread2.sqlj—Threads With Explicit Connection Contexts on page C-16
StreamParcels.sqlj—Stream Access Mode on page C-19
StreamTimeout.sqlj—Stream Timeout Setting on page C-22
EmbeddedDelete.sqlj—Embedded DELETE on page C-25
EmbeddedUpdate.sqlj—Embedded UPDATE on page C-28
SetOnRollback.sqlj—Setting Column Values on Rollback on page C-31
Using SQLJ Source Files
The SQLJ source files of the sample programs are located in a JAR file named
sampleSQLJ.jar in the NonStop Technical Library (NTL).
Installing the sampleSQLJ.jar File
1. In NTL, navigate to the G06.23 or later RVU.
2. From the Categories list, click Sample Programs.
3. Under Publications, click SQL/MX SQLJ Source Files.
4. Follow the instructions in NTL for downloading the sampleSQLJ.jar file to your
PC workstation.
5. On your PC, use WinZip to open the sampleSQLJ.jar file and view the
README.txt file, which explains how to use sampleSQLJ.jar.
To use the source files in
sampleSQLJ.jar, place the JAR file in the desired OSS
directory, extract the source files, and process them by using the SQLJ translator
program. For more information, see the README file.
Installing the SQL/MX Sample Database
The sample programs rely on the SQL/MX sample database (product T0517) to run
properly. All the sample programs, except SampleDDL, can query both SQL/MP and
SQL/MX tables of the SQL/MX sample database. To query SQL/MP tables, use the