Developing SQLJ applications

To develop SQLJ applications, the following software is required:

To develop SQLJ applications in the workbench, your project must support Java development. For example, you can use a J2EE project, a Web project, an EJB project, or a Java project.

Limitation: SQLJ development is not supported for projects that have separate output directories for each source folder, instead of one output directory for the project. Your project can use only one output directory.

To develop an SQLJ application:

  1. Click File > New > Other, or click New on the toolbar.

  2. In the New window, expand the Data folder, and then expand the SQLJ folder.

  3. Select the appropriate SQLJ wizard and then click Next.

  4. Optional: Edit your SQLJ files with the SQLJ editor.

  5. Build the project. The workbench runs the SQLJ translator on the SQLJ files to convert them to Java code, then compiles the generated Java files.

  6. To run the code in the project, click Run on the toolbar or click Run > Run.

  7. To debug the application, click Debug on the toolbar or click Run > Debug to debug SQLJ files using the Debug wizard.

  8. DB2 Universal Database only: After the project is running properly, use a wizard to customize and bind the SQLJ profiles to the database.

Introduction to SQLJ
SQLJ enables you to embed SQL statements into Java programs. SQLJ is an ANSI standard developed by a consortium of leading providers of database and application server software including IBM Corporation, Microsoft Corporation, Sun Microsystems, and Oracle.

Application performance with SQLJ
The static SQL that SQLJ uses can often run faster than the dynamic SQL that JDBC uses.