Simplify the process of customizing and binding SQLJ profiles
for your 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.
Before you begin
You must have an SQLJ application that has already been deployed
and installed in the application server.
For SQLJ applications
that use container-managed persistence, you 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.
About this task
To take advantage of SQLJ applications in the application
server, you 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, you 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:
- For scripting support, read the topic on the application management
command group for the AdminTask object.
- For information on the db2sqljcustomize tool, read the topic on
customizing and binding SQLJ profiles with the db2sqljcustomize tool
for more information. If you customize profiles with the db2sqljcustomize
tool, you will need to reinstall the application.
Procedure
- Make sure the necessary database tables exist, as described
in the topic on deploying data access applications.
- Navigate to the SQLJ application that is installed in the
application server. Click .
Avoid trouble: Do not run multiple sessions
of the administrative console to customize and bind profiles that
are in the same EAR file.
gotcha
- Navigate to the SQLJ profiles section. Click SQLj
profiles. When you 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 you are working:
- If your 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.
- Choose to select profiles or a profile group to customize
and bind.
- Select profiles from the list that is provided.
- 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.
bprac
- 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. You can use the .grp file for other binding
operations in the future. After you 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.
- Complete the necessary information to connect to the database. You 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
- Specifies the user ID for the database administrator on the server
where the database is located.
- Password
- Specifies the 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
- Specifies the class path where sqlj.zip, and db2jcc.jar or db2jcc4.jar
are located.
- Click OK.
Avoid trouble: If you are processing a large enterprise application,
or you 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, you 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.
gotcha
Results
After the application server 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 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.