Customize and binding 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 administrative console or with scripting. SQLJ profiles must be customized and bound before the enterprise application can use the application's embedded SQL.
We must have an SQLJ application that has already been deployed and installed in the application server.
For SQLJ applications that use container-managed persistence, we can deploy the application in two ways:
- Deploy the SQLJ application in the application server. See the topic on deploying SQLJ applications that use container-managed persistence (CMP) for more information.
- Deploy SQLJ applications with the ejbdeploy tool. See the topic on deploying SQLJ applications that use container-managed persistence (CMP) with the ejbdeploy tool.
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 application server, 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.
We can also customize and bind profiles with scripting or the db2sqljcustomize tool:
- For scripting support, read the topic on the application management .
- For information on the db2sqljcustomize tool, read the topic on customizing and binding SQLJ profiles with the db2sqljcustomize tool for more information. If we customize profiles with the db2sqljcustomize tool, we will need to reinstall the application.
Tasks
- Make sure the necessary database tables exist, as described in the topic on deploying data access applications.
- Navigate to the SQLJ application installed in the application server. Click Applications > WebSphere enterprise applications > app_name.
Do not run multiple sessions of the administrative console to customize and bind profiles in the same EAR file.
- Navigate to the SQLJ profiles section. Click SQLj profiles. When we click this link, the application server expands the EAR file for the application into a temporary directory; there might be a delay before the panel for SQLJ profiles is displayed.
- Select Customize and bind profiles or Bind packages. Choose your option based on the profiles with which we are working:
- If our profiles have not been customized, or we want to customize the profiles again, choose Customize and bind profiles.
- If the profiles are already customized, choose Bind packages.
- Choose to select profiles or a profile group to customize and bind.
- Select profiles from the list provided.
- Select the profiles from the list and click Add. The list displays the SQLJ profiles present in the enterprise application.
- 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.
bprac
- Select Customize/bind the selected SQLj profiles as a group This option specifies that the application server will create a .grp file containing 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, we 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.
- Complete the necessary information to connect to the database. We need to complete the following fields:
- Database URL
- 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> ororfully_qualified_host_name:port
- User
- User ID for the database administrator on the server where the database is located.
- Password
- 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.
- Click OK.
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 administrative console. The default connection timeout for the application server's administrative 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.
After the application server finishes processing the SQLJ profiles, we 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 application server.
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.
Subtopics
- Customizing and binding SQLJ profiles with the db2sqljcustomize tool
Customize and bind SQLJ profiles with the db2sqljcustomize tool before we install the SQLJ application in the application server.- SQLJ profiles and pureQuery bind files settings
Use this page to do customization and binding for the Structured Query Language in Java (SQLJ) profiles for DB2 included in this application. We can also use this page to do binding for pureQuery bind files in the application. We can view SQLJ profiles for other database types, but we cannot change these profiles. PureQuery bind files are only valid for DB2. Use SQLJ or pureQuery to develop data access applications that connect to DB2 databases. SQLJ is a set of programming extensions that enable a programmer to use the Java programming language to embed statements that provide SQL database requests. PureQuery provides an alternate set of APIs that can be used instead of JDBC to access the DB2 database.- Download SQLJ profile group
Use this page to download the group file for the Structured Query Language in Java (SQLJ) profiles that are bound together as a single package on the DB2 database server. Use the file when performing future customization or binding work on the application. Click the link provided to download the profile group to the local file system. The group file has a filename extension of .grp and a HTTP Content-Type of text/plain. Your web browser settings might cause the browser to display the file contents rather than prompting you for a download destination. If this happens, we can manually copy and paste the contents into our own .grp file.- Review results
Use this panel to review the results from the customization and binding process for the Structured Query Language in Java (SQLJ) profiles or pureQuery bind files. Use SQLJ or IBM Optimâ„¢ PureQuery Runtime to develop data access applications that connect to DB2 databases. SQLJ is a set of programming extensions that enable a programmer to use the Java programming language to embed statements that provide SQL (Structured Query Language) database requests. IBM Optim PureQuery Runtime provides an alternate set of APIs that can be used instead of JDBC to access the DB2 database.- Customizing and binding SQLJ profiles with the db2sqljcustomize tool
Customize and bind SQLJ profiles with the db2sqljcustomize tool before we install the SQLJ application in the application server.- SQLJ profiles and pureQuery bind files settings
Use this page to do customization and binding for the Structured Query Language in Java (SQLJ) profiles for DB2 included in this application. We can also use this page to do binding for pureQuery bind files in the application. We can view SQLJ profiles for other database types, but we cannot change these profiles. PureQuery bind files are only valid for DB2. Use SQLJ or pureQuery to develop data access applications that connect to DB2 databases. SQLJ is a set of programming extensions that enable a programmer to use the Java programming language to embed statements that provide SQL database requests. PureQuery provides an alternate set of APIs that can be used instead of JDBC to access the DB2 database.- Download SQLJ profile group
Use this page to download the group file for the Structured Query Language in Java (SQLJ) profiles that are bound together as a single package on the DB2 database server. Use the file when performing future customization or binding work on the application. Click the link provided to download the profile group to the local file system. The group file has a filename extension of .grp and a HTTP Content-Type of text/plain. Your web browser settings might cause the browser to display the file contents rather than prompting you for a download destination. If this happens, we can manually copy and paste the contents into our own .grp file.- Review results
Use this panel to review the results from the customization and binding process for the Structured Query Language in Java (SQLJ) profiles or pureQuery bind files. Use SQLJ or IBM Optim PureQuery Runtime to develop data access applications that connect to DB2 databases. SQLJ is a set of programming extensions that enable a programmer to use the Java programming language to embed statements that provide SQL (Structured Query Language) database requests. IBM Optim PureQuery Runtime provides an alternate set of APIs that can be used instead of JDBC to access the DB2 database.
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 SQLJ applications Application management