SQLJ

SQLJ is an International Organization for Standardization (ISO) standard language specification for creating JDBC statements. For developers who do not wish to learn the native JDBC calls, SQLJ is a solution for embedding database directives within your Java program. Similar to Oracle s Pro*C, Pro*FORTRAN, and Pro*COBOL precompilers, the SQLJ translator reads a Java input file with a .sqlj extension, and converts the directives to the corresponding JDBC calls. Because JDBC is not dependent on any database vendor, all leading database vendors , including Oracle, support SQLJ.

There are some advantages to using SQLJ instead of coding calls to the JDBC API, including smaller program sizes, typed cursors and result sets, and compile-time checking of SQL statements. Because of these advantages, SQLJ is the default output of tools such as Oracle s JPublisher, a utility used to generate classes that represent data entities such as PL/SQL packages within a client application. Note that unless otherwise specified, JPublisher deletes the SQLJ source files after generating the output Java files with the corresponding JDBC calls.

When writing database calls for using a language such as C, it makes sense to use a precompiler to handle building the complex native Oracle Call Interface (OCI) API calls. Conversely, writing JDBC calls is straightforward; therefore, there is less of a need for this functionality with Java programs.

To use SQLJ, you must include the <ORACLE_HOME>/sqlj/lib/translator.jar and the <ORACLE_HOME>/sqlj/lib/runtime12.jar archives in your class path . Invoke the SQLJ translator using the sqlj command.



Oracle Application Server 10g Web Development
Oracle Application Server 10g Web Development (Oracle Press)
ISBN: 0072255110
EAN: 2147483647
Year: 2004
Pages: 192

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net