SQLJ
Appearance
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.