Accessing databases using DB2 SQLJ support

DB2® Structured Query Language for Java™ (SQLJ) support is based on the SQLJ ANSI standard. The DB2 SQLJ support is contained in the IBM® Developer Kit for Java. DB2 SQLJ support allows you to create, build, and run embedded SQL for Java applications.

The SQLJ support provided by the IBM Developer Kit for Java includes the SQLJ run-time classes, and is available in /QIBM/ProdData/Java400/ext/runtime.zip.

SQLJ setup

Before you can use SQLJ in Java applications on your server, you need to prepare your server to use SQLJ. For more information, see the SQLJ setup topic.

SQLJ tools

The following tools are also included in the SQLJ support provided by the IBM Developer Kit for Java:

  • The SQLJ translator, sqlj, replaces embedded SQL statements in the SQLJ program with Java source statements and generates a serialized profile that contains information about the SQLJ operations that are found in the SQLJ program.
  • The DB2 SQLJ Profile Customizer, db2profc, precompiles the SQL statements stored in the generated profile and generates a package in the DB2 database.
  • The DB2 SQLJ Profile Printer, db2profp, prints the contents of a DB2 customized profile in plain text.
  • The SQLJ profile auditor installer, profdb, installs and uninstalls debugging class-auditors into an existing set of binary profiles.
  • The SQLJ profile conversion tool, profconv, converts a serialized profile instance to Java class format.
Note: These tools must be run in the Qshell Interpreter.

DB2 SQLJ restrictions

When you create DB2 applications with SQLJ, you should be aware of the following restrictions:

  • DB2 SQLJ support adheres to standard DB2 Universal Database restrictions on issuing SQL statements.
  • The DB2 SQLJ profile customizer should only be run on profiles associated with connections to the local database.
  • The SQLJ Reference Implementation requires JDK 1.1, or higher. See the Support for multiple Java Development Kits (JDKs) topic for more information on running multiple versions of the Java Development Kit.