DB2 SQLJ profile customizer
DB2 SQLJ support enables you to build and run SQLJ applets and applications. The DB2 SQLJ profile customizer, db2sqljcustomize, is one of the components of SQLJ, the other two components being the translator and the run time.
As part of SQLJ application development, you first translate a source SQLJ program by running the DB2 SQLJ translator on the .sqlj file. The result is Java code based on the embedded SQL statements within the source SQLJ program as well as a binary representation of the SQL statements that is created in a separate serialized SQLJ profile (.ser file).
You can then run the DB2 SQLJ profile customizer to process this .ser file. The customizer augments the profile with DB2-specific information for use at run time. By default, static SQL packages that contain precompiled code are created when the profile is customized. It is these packages that are retrieved when the application is run. This retrieval results in the application running faster than in the case when JDBC is used. When JDBC is used, the code has to be compiled dynamically and that takes longer. You can defer the package creation to a later time by specifying the -automaticbind no option. But, create them before you can run the application.
In summary, you use the DB2 SQLJ profile customizer after the application is translated but before it can be run.
The DB2 SQLJ profile customizer and EJB deployment
In order to deploy enterprise beans using SQLJ for data access, first run the EJB deployment tool. The tool calls the DB2 SQLJ translator in order to generate the customization profiles. There is at least one customization profile for each EJB JAR file. It is located in one of the subdirectories below the websphere_deploy directory, for example FS_TopDown1_SJProfile0.ser.
You can now run the DB2 SQLJ profile customizer. In order to make the customization step easier, when the SQLJ ejbdeploy command with the -sqlj option is run against an EAR file, it produces an Ant script, which can be used to run the DB2 SQLJ profile customizer against every customization profile in every EJB JAR in the associated EAR. The script will update each EJB JAR file with the modified customization profile, and will replace the JAR files in the EAR with the modified version. This Ant script is specific to the corresponding EAR file and it modifies the existing EAR file.
The customization step, namely, running db2sqljcustomize against the customization profile, creates four database packages which contain the static SQL, one for each isolation level. The customization step also updates the generated customization profiles, and the updated profiles must be available to the generated code at run time. They must be included in the actual EJB JAR file, which is installed into WebSphere Application Server.
If you do not perform the customization step, the enterprise beans will still run, but they will not use the static SQL stored in the database, and you will not get any of the performance benefits of SQLJ.
Consult the DB2 documentation for more information on running the DB2 SQLJ profile customizer, or visit www7b.boulder.ibm.com/dmdd/zones/java/bigpicture.html (section SQLJ support).
Related concepts
enterprise beans on either a test or production server, you need to generate deployment code for the enterprise beans. You can do this using the EJB deployment tool. You can either use the command-line interface that it provides or you can invoke it from the workbench.">EJB deployment tool
Related tasks
Editing SQLJ customization scripts (DB2 only)
Running SQLJ customization scripts (DB2 only)
Generating SQLJ customization scripts (DB2 only)
Related reference
The ejbdeploy command