SQLj

The SQLj initiative defines three ways to combine Java and SQL:

  • SQLj Part 0 defines a mechanism for embedding SQL calls within Java code. The SQL is converted into JDBC calls by using a preprocessor.

  • SQLj Part 1 inverts this, placing Java within SQL. It defines extensions to the SQL syntax to allow Java static methods to be called either as if they were SQL stored procedures or as user-defined functions within SQL statements.

  • SQLj Part 2 also places Java within SQL, but here providing a mechanism for Java classes to be used to define SQL types. This allows table columns to be defined as a type of a Java class; a Java object instance can thus be stored directly in the column.

The following sections look at each of these in turn.

SQLj Part 0 ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.