Deploying EJB applications using SQLJ for data access
Deploying enterprise beans which use SQLJ as their persistence mechanism is more complicated than regular deployment. As part of the generation of deployment code, one or more SQLJ customization profiles will be created. You can then run the DB2 SQLJ profile customizer against the customization profiles to produce static SQL in the database.
Additional considerations when deploying enterprise beans using SQLJ for EJB Persistence
Deploying non-CMP beans
If you want to deploy non-CMP beans (session beans, BMP beans, and servlets) for existing J2EE applications, using SQLJ as the persistence mechanism, first port the .java file to .sqlj.
Follow these topics in sequence in order to deploy your application:
- Requirements for deploying EJB applications using SQLJ
Make sure you have the following requirements in place before you try to deploy your EJB applications using SQLJ:- Configuring EJB applications to use SQLJ instead of JDBC for enterprise bean persistence (workbench only)
You can use SQLJ instead of JDBC to make calls to a DB2 database when deploying 2.x CMP beans. SQLJ is a standard set of programming extensions, which allows the use of Java classes to define SQL types, which can then be used as columns in tables. It allows you to embed SQL database statements in a Java program.- Running the EJB deployment tool
You can run the EJB deployment tool either from the workbench or from the command line.- Preliminary steps for running the DB2 SQLJ profile customizer using the Ant script
When you deploy enterprise beans, you can run the DB2 SQLJ profile customizer indirectly by using an Ant script that is generated as a result of running the ejbdeploy command against the EAR file.- Running the Ant script
In order to make running the DB2 SQLJ profile customizer, db2sqljcustomize, easier, you can employ an Ant script. This particular Ant script is the one that is created when the batch SQLJ ejbdeploy command is run against an EAR file.- Installing the EAR file on the server
Once you have run the DB2 SQLJ profile customizer on the SQLJ customization profiles by using the Ant script, the EAR files are updated with a modified customization profiles. You can now install these updated EAR files on either the test or the production server.
Parent topic
EJB deployment tool
Related concepts
DB2 SQLJ profile customizer
Related tasks
Generating EJB deployment code from the workbench
Generating EJB deployment code from the command line
Deleting deployment code