Choosing SQLJ or JDBC
JDeveloper supports two mechanisms for embedding SQL in Java programs:
-
SQLJ: If you know the PL/SQL
tables and columns involved at compile time (static application), you
can use SQLJ. SQLJ is an industry standard for defining precompiled
SQL code in Java programs.
SQLJ allows you to code at a higher
level than JDBC, by embedding SQL statements directly in your Java
code. The SQLJ precompiler that is integrated into JDeveloper
translates the SQL into Java plus JDBC code for you. SQLJ with
JDeveloper lets you write and debug applications much faster than you
can using just JDBC.
-
JDBC: If you require
fine-grained control over database access, or if you are developing an
application that requires precise information about database (or
instance) metadata, you can code your application entirely in Java
using the JDBC API.
You can mix JDBC calls with SQLJ statements in your program. One way to
do this is through connection context sharing.
Related topics
About SQL
About Oracle JDBC drivers
About SQLJ
versus JDBC
Copyright © 1997, 2004, Oracle.
All rights reserved.