+

Search Tips   |   Advanced Search

Customize profiles for Structured Query Language in Java(SQLJ) applications


Simplify the process of customizing and binding SQLJ profiles for the applications by performing these functions in the admin console or with scripting. SQLJ profiles must be customized and bound before the enterprise application can use the application's embedded SQL. You must have an SQLJ application that has already been deployed and installed in the appserver. For SQLJ applications that use container-managed persistence, we can deploy the application in two ways:

For SQLJ application that use bean-managed persistence, see the topic on deploying SQLJ applications that use bean-managed persistence, servlets, or session beans.

To take advantage of SQLJ applications in the appserver, we need to customizing the SQLJ profiles that contain the embedded SQL statements. By default, four DB2 packages are created in the database; one for each isolation level. The customization process augments the profiles with information that is specific to the DB2 database. The database uses this information at run time.

In addition to profile customization, we need to bind the customized profiles to the DB2 database. Profile binding should only take place after the SQLJ profiles are customized. You can also customize and bind profiles with scripting or the db2sqljcustomize tool:

 

  1. Make sure the necessary database tables exist.

  2. Navigate to the SQLJ application that is installed in the application server. Click Applications > Websphere enterprise apps > app_name .

    Avoid trouble: Do not run multiple sessions of the admin console to customize and bind profiles in the same EAR file.

  3. Navigate to the SQLJ profiles section. Click SQLj profiles. When you click this link, the appserver expands the EAR file for the application into a temporary directory; there might be a delay before the panel for SQLJ profiles is displayed.

  4. Select Customize and bind profiles or Bind packages. Choose the option based on the profiles with which we are working:

    • If the profiles have not been customized, or you want to customize the profiles again, choose Customize and bind profiles.

    • If the profiles are already customized, choose Bind packages.

  5. Choose to select profiles or a profile group to customize and bind.

    • Select profiles from the list that is provided.

      1. Select the profiles from the list and click Add. The list displays the SQLJ profiles that are present in the enterprise application.

        Best practice:

        • Select more than one profile by holding CTRL.

        • Select a contiguous list of profiles by selecting the first profile name, holding SHIFT, and selecting the last profile. You will select the first profile, last profile, and any profiles in the middle.

      2. Select Customize/bind the selected SQLj profiles as a group This option specifies that the application server will create a .grp file that contains the SQLj profiles that are processed. Use the .grp file for other binding operations in the future. After we have completed this panel and click OK, you will be given an option to download the .grp file.

    • Select Use a profile group file to specify profiles to customize/bind. Select this to specify a profile group to process. Click Browse... to locate the file on the system.

  6. Complete the necessary information to connect to the database. we need to complete the following fields:

    Database URL

    Specifies the URL of the database to which the profile/s will be bound. The typical syntax is:

    jdbc:db2:
    //<host name="">:<port>/<database name="">.</database></port></host> or 
    
    or

    fully_qualified_host_name:port
    

    User

    User ID for the database administrator on the server where the database is located.

    Password for the database administrator on the server where the database is located.

    Additional options

    Specifies additional options to use during the customization and bind processes. See the DB2 documentation for a complete list of customization options.

    Class path

    Class path where sqlj.zip, and db2jcc.jar or db2jcc4.jar are located.

  7. Click OK.

    Avoid trouble: If we are processing a large enterprise application, or we are processing many SQLJ profiles, the process might take longer than the default timeout for the admin console. The default connection timeout for the application server's admin console is set to 30 minutes. If the default timeout is reached and you lose the connection to the server, we can check the system output log for the final results of the customization and bind process.

    To prevent this disconnection, configure the console session timeout to a longer period of time. After a successful customization and binding process, check the system output log for the total processing time. Use that time period as a basis for the new timeout value. For information about how to configure the console timeout, see the topic on changing the console session expiration.

 

Results

After the appserver finishes processing the SQLJ profiles, you will see the results from the customization and binding. The results panel displays messages from the database server, as well as summary results from the appserver.If the operation completed successfully, the following message will be printed to the system log:

ADMA0507I=ADMA0507I: The SQLJ operation on application {0} completed successfully.  Exit code: {1} ADMA0507I.explanation=This informational message indicates the program status. ADMA0507I.useraction=No user action is required.
If the operation did not complete successfully, the following message will be printed to the system out log:

ADMA0506I=ADMA0506I: The SQLJ operation on application {0} did not complete successfully.  Exit code: {1} ADMA0506I.explanation=The SQLJ operation encountered a problem.  This informational message indicates  the program status. Prior messages in the command output give details of the problem. ADMA0506I.useraction=Check the command output for the cause of the problem.


Customize SQLJ profiles with the db2sqljcustomize tool
SQLj profiles and pureQuery bind files settings
Download SQLj profile group
Review results

 

Related tasks


Deploy SQLJ applications that use container-managed persistence (CMP)
Deploy SQLJ applications that use bean-managed persistence, servlets, or sessions beans
Deploy SQLJ applications that use container-managed persistence (CMP) with the ejbdeploy tool
Rational Application Developer: Developing SQLJ applications
Deploy Structured Query Language in Java (SQLJ) applications

 

Related


Application management