SQL/MX Programming Manual for Java

SQLJ Programming
HP NonStop SQL/MX Programming Manual for Java523726-003
3-4
Naming Restrictions and Reserved Words
Naming Restrictions and Reserved Words
The SQLJ translator generates variables that use this six-character prefix: __sJT_. Do
not use this prefix for any fields, variables, or parameters in an SQLJ source file.
The SQLJ translator generates internal classes and files that use this prefix:
filename_SJ, where filename is the name of the SQLJ source file. Do not use this
prefix for the class or file names.
For information about using reserved words in SQL statements, see the SQL/MX
Reference Manual.
Code Initialization
In an SQLJ source file, you can include code for:
Specifying the Java Package of an SQLJ Program on page 3-4
Importing Java Packages on page 3-5
Registering and Loading the JDBC/MX Driver on page 3-6
Specifying the Java Package of an SQLJ Program
A Java package contains a group of related Java classes and subpackages and is
named after the directory structure of its class files. In an SQLJ program, the package
groups related class files, profiles, and module definitions in a common storage
location and prevents naming conflicts.
The package Statement
Use the package statement to specify the package to which the class files of the
SQLJ program belong. Place the package statement at the beginning of the SQLJ
source file before all other statements. You can only have only one package
statement in an SQLJ source file.
The package statement produces a subdirectory path into which the SQLJ translator
program generates class files, profiles, and module definition files (if you choose to
generate them) of the SQLJ program.
For example, this SQLJ source file exists in the /usr directory:
/usr/MyProg.sqlj
The SQLJ translator program processes the SQLJ source file, which includes a
package statement:
package pkg.subpkg;
...
public class MyProg {
...
}