NonStop Systems Introduction
The Relational Database Management System
NonStop Systems Introduction—527825-001
4-9
SQL/MX and Applications
binds the host language portion and the SQL language portion of the program into a 
single object file. The program is ready for use in a production environment.
To compile a Java source program containing embedded SQL statements, you run the 
SQLJ translator. SQLJ allows you to embed static SQL statements directly in a Java 
program. The purpose of an SQLJ program is to support static SQL statements in a 
Java program and to yield the performance benefits of statically compiled SQL in a 
portable application. The benefits of SQLJ include:
•
Support for static SQL statements (in addition to dynamic statements supported by 
JDBC)
•
Robust programming because of online checking of SQL statements during 
program development
•
Portability of binary code across different vendors’ databases: you can run the 
same application against any database server without modifying, retranslating, and 
recompiling the source code
You can use your SQLJ programs as servlets in Web applications and as enterprise 
beans in NonStop EJB applications.
Another popular database access tool for Java programmers is the Java Database 
Connectivity (JDBC) API. JDBC provides universal data access for the Java 
programming language. The JDBC API consists of a set of classes and interfaces 
written in Java that provide a standard API for application developers. Using the JDBC 
API, Java programs can directly query an SQL/MX database. JDBC is included as a 
component of NonStop EJB.
Because the Java language is powerful and easy to use, it is an excellent choice for 
database applications. JDBC makes it possible to write robust database applications 
using a Java-based API. JDBC is also highly portable, being able to access virtually 
any type of database.
SQL/MX and Applications
The SQL/MX programming interface makes it possible for programmers to include SQL 
statements in applications. Specifically, programmers can embed SQL statements in 
server programs written in COBOL, C, C++, and Java. As a result, the servers can 
access SQL/MX tables and select, insert, update, or delete rows in these tables.
Figure 4-5 on page 4-10 shows the relationship between applications and SQL/MX in 
the NonStop application environment.










