Deploying SQLJ applications that use container-managed persistence (CMP) with the ejbdeploy tool

Embed Structured Query Language in Java™ (SQLJ) statements in your applications to maximize the efficiency of transactions with your databases. Before your applications can take advantage of SQLJ, you must deploy the application and customize the SQLJ profiles that are created. The application server provides functionality to use SQLJ as the persistence mechanism for enterprise beans that use container-managed persistence. Use the ejbdeploy tool to deploy the application.

About this task

You can deploy SQLJ applications with the ejbdeploy tool to deploy the enterprise application in a standalone environment.
Alternatively, the application server includes enhanced SQLJ support for applications that use container-managed persistence (CMP). The new features include:
  • Deploying CMP beans during the application installation in the application server.
  • Customizing and binding SQLJ profiles with the administrative console or scripting.
  • Customizing and binding SQLJ applications again without needing to reinstall the application.
These enhancements reduce the complexity of installing, deploying, and customizing SQLJ applications for both container-managed and bean-managed persistence.Read the topic on deploying SQLJ applications that use container-managed persistence (CMP) for more information.

Procedure

  1. Create a top-down mapping to a DB2® database.
  2. From your DB2 installation, copy the sqlj.zip file to a directory on your workstation.
  3. Modify the Java build path of your enterprise bean JAR project to include the sqlj.zip file.
  4. Use Rational® Application Developer or the DB2 SQLJ translator to automatically translate SQLJ.
    • Use Rational Application Developer:
      1. From the Project Navigator, click EJB_JAR_PROJECT_NAME > SOURCE_FOLDER > META-INF > backends > database_version .
      2. Open Map.mapxmi in the Mapping editor.
      3. On the Overview panel, highlight the name of your JAR project in the Enterprise Beans column. You must highlight the name of the JAR project, not the name of one of the enterprise beans that is listed.
      4. On the Properties panel, expand SQLJ.
      5. Set Is using SQLJ? to True.
      6. Set Translator Module to the fully qualified path of the sqlj.zip file on your workstation.
      7. Save the Map.mapxmi file.
      8. Export the enterprise archive (EAR) file.
    • Use the DB2 SQLJ translator. This tool creates a .java version of your .sqlj file and a serialized profile, with a .ser extension, that is used later in processing. Refer to the DB2 documentation for more information on the SQLJ translator tool.
  5. Deploy the EAR file with the ejbdeploy tool.
    1. Verify that the app_server_root/bin directory is in your class path.
    2. Run the ejbdeploy command utility with the -sqlj option. The ejbdeploy command will generate an EAR file with the name you specify and an Ant script with the name application_name.ear.xml.
      For example: :
      ejbdeploy d:\application_name.ear           
                working d:\deployed_application_name.ear 
                -sqlj           
                -dbvendor DB2UDB_V81           
                -cp "C:\PROGRA~1\IBM\SQLLIB\java\sqlj.zip"
      Avoid trouble: Supply the location of the SQLJ translator sqlj.zip file with -cp, which is the class path option The ejbdeploy command does not access sqlj.zip from your system class path.gotcha
  6. Choose the option for customization.
    • Use the application server's SQLJ support. Install the deployed application to customize the SQLJ profiles with the application server or scripting.
      1. Install the enterprise application in the application server.
        Avoid trouble: Do not select Deploy enterprise beans during the application installation process in the administrative console. If you redeploy the enterprise beans from the administrative console, you will lose the customization changes that you have made.gotcha
      2. Customize the SQLJ profiles.
        • For administrative console support, read the topic on customizing and binding profiles for Structured Query Language in Java (SQLJ) applications.
        • For scripting support, read the topic on the application management command group for the AdminTask object.
    • Customize and bind the SQLJ profiles with the db2sqljcustomize tool. Read the topic on customizing and binding SQLJ profiles with the db2sqljcustomize tool.



In this information ...


Related concepts

IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic    

Terms of Use | Feedback

Last updated: Oct 21, 2010 7:37:48 AM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v701sca&product=was-nd-mp&topic=tdat_sqljdeploycmptool
File name: tdat_sqljdeploycmptool.html