SQL/MX Programming Manual for Java

SQLJ Programming
HP NonStop SQL/MX Programming Manual for Java523726-003
3-5
Importing Java Packages
The SQLJ translator program generates class files and other program files in this
directory structure:
/usr/pkg/subpkg/MyProg.class
Importing Java Packages
All classes, including the class files of an SQLJ program, belong to a package. When a
program refers explicitly to a visible class outside the package of the program, you
must do one of the following:
Use the fully qualified name of the class.
Import the class.
Import the entire package.
The import Statement
Specify the import statement to import, or refer, to a class or package. The import
statement does not actually load the referenced class or package into a program.
Instead, it refers to the class or package, enabling you to avoid fully qualified package
names throughout the source code. Place the import statements at the beginning of
the SQLJ source file, after the package declaration and before the class declaration.
The java.lang Package
The java.lang package consists of basic Java language classes. This package is
imported into a Java program by default, so you need not explicitly import this package
or use fully qualified names for the classes from this package.
The java.sql Package
The java.sql package contains the JDBC interfaces used by SQLJ. To use classes
from the java.sql package you must either explicitly import the java.sql package
into an SQLJ program or use fully qualified names for the classes from this package
(for example, java.sql.Connection, java.sql.SQLException, or
java.sql.Date). To import this package, code this import statement at the
beginning of an SQLJ source file:
import java.sql.*;
For more information about the standard Java packages, see Sun Microsystems’ API
Documentation at http://java.sun.com/.
The sqlj.runtime Package
The sqlj.runtime package contains the ANSI standard set of SQLJ run-time
interfaces. You must either import the sqlj.runtime package or use fully qualified
names for the classes from this package (for example,