Deploying a serialized SQLJ profile in a JVM server

SQLJ provides support for embedded static SQL in Java™ applications. You deploy a serialized SQLJ profile in an OSGi JVM server or a Liberty JVM server as an alternative to using the JDBC application programming interface.

Before you begin

You must prepare your SQLJ program using the following process: Program preparation for SQLJ programs.

Once the DBRMs have been created they must be bound into a Db2® Plan or Package and a Db2 Entry specifying the Db2 plan defined to CICS®. Failing to do this will most probably result in SQL -805 errors or SQLJ defaulting to use JDBC. Download the serialized profile file to the workstation where the bundle is being created. Ensure that the transfer is done using the binary format, so that there is no code page conversion. This will prevent problems later.

Now a decision is needed about where to put the serialized profile file. There are two scenarios:

Procedure

  1. Scenario one - keep the serialized profile within the deployed bundle.
    1. For OSGI bundles the serialized profile can be kept in the bundle root directory or in the bundles class directory. For Liberty bundles it must go into the bin directory with the other classes.
  2. Scenario two - externalize the profile.
    1. Move the serialized profile from within the jar to a directory in the USS file system, for example /usr/lpp/cicsts/dev/sqlj.profile.dir . The file needs to be in a directory with the same package structure such as /usr/lpp/cicsts/dev/sqlj.profile.dir/com/ibm/cics/test/sqlj/CurrentTimeStamp_SJProfile0.ser.
    2. Add an entry to the bundle manifest.
      Bundle-ClassPath: .,external:$sqlj.profile.dir$
      The string 'external' indicates a location external to the bundle and the string enclosed with $ substitutes the value of a Java system property, that is sqlj.profile.dir.
    3. Add a Java system property similar to this example in the JVM profile:
      -Dsqlj.profile.dir=/usr/lpp/cicsts/dev/sqlj.profile.dir

Results

You have successfully deployed a serialized SQLJ profile.