Jump to content

SQLJ

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by DE103252 (talk | contribs) at 17:17, 12 July 2006 (Translated from German version). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

SQLJ is an ISO standard for embedding SQL statements in Java programs.

Unlike JDBC, SQLJ is not an API but a language extension. Thus, SQLJ programs must be run through a preprocessor (the SQLJ translator) before they can be compiled.

SQLJ has several advantages over JDBC:

  • SQLJ programs are easier to write and to maintain. They also tend to be shorter than equivalent JDBC programs.
  • It is more efficient than JDBC since the SQL statements are parsed and the access paths are optimized at compile time rather than runtime.
  • It provides better authorization control: Authorization can be granted to programs rather than users.

There are some disadvantages:

  • SQLJ requires a preprocessing step.
  • Many IDEs do not have SQLJ support.
  • There is no SQLJ support for most of the common persistence frameworks, such as Hibernate.