Program preparation for SQLJ programs

Program preparation for SQLJ programs involves translating, compiling, customizing, and binding programs.

About this task

The following figure shows the steps of the program preparation process for a program that uses the IBM® Data Server Driver for JDBC and SQLJ.
Figure 1. The SQLJ program preparation process
Begin figure description. This figure depicts the program preparation process for an SQLJ application. End figure description.

Procedure

The basic steps in SQLJ program preparation are:

  1. Run the sqlj command from the z/OS® UNIX System Services command line to translate and compile the source code.

    The SQLJ command generates a Java source program, optionally compiles the Java source program, and produces zero or more serialized profiles. You can compile the Java program separately, but the default behavior of the sqlj command is to compile the program. The SQLJ command runs without connecting to the database server.

  2. Run the db2sqljcustomize command from the z/OS UNIX System Services command line to customize the serialize profiles and bind DB2® packages.
    The db2sqljcustomize command performs these tasks:
    • Customizes the serialized profiles.
    • Optionally does online checking to ensure that application variable types are compatible with the corresponding column data types.

      The default behavior is to do online checking. For better performance, you should do online checking.

    • Optionally binds DB2 packages on a specified database server.

      The default behavior is to bind the DB2 packages. However, you can disable automatic creation of packages and use the db2sqljbind command to bind the packages later.

      You might also need to run the db2sqljbind command under these circumstances:
      • If a bind fails when db2sqljcustomize runs
      • if you want to create identical packages at multiple locations for the same serialized profile
  3. Optional: Bind the DB2 packages into a plan.

    Use the DB2 BIND command to do that.