From Oracle FAQ
Jump to: navigation, search

SQLJ is an ISO standard (ISO/IEC 9075-10) for embedding SQL statements in Java programs.

SQLJ provides a Java precompiler that translates SQLJ calls to JDBC calls. The idea is similar to that of other Precompilers.

SQLJ is more concise and thus easier to write than JDBC, and provides compile-time schema validation and syntax checking for easier debugging. SQLJ reads input either from a *.SQLJ file, or a Java source file in which SQLJ statements are embedded. The SQLJ precompiler translates the SQLJ statements into their equivalent JDBC calls. SQLJ only supports static SQL.

[edit] Writing SQLJ programs

See the Scripts#SQLJ_Programs section for some SQLJ example programs.

[edit] Deployment

Use the sqlj compiler to compile your *.sqlj files to *.java and *.ser files. The *.ser files contain vendor specific database code.

After that, invoke the javac compiler to compile the .java files to *.class files.

The *.class and *.ser files can then be deployed to the runtime environment.

[edit] External links