Binding Sqlj Applications To Access Multiple Database Servers - IBM DB2 Manual

Table of Contents

Advertisement

Binding SQLJ applications to access multiple database servers

After you prepare an SQLJ program to run on one DB2 database server, you might
want to port that application to other environments that access different database
servers. For example, you might want to move your application from a test
environment to a production environment.
The general steps for enabling access of an existing SQLJ application to additional
database servers are:
1. Bind packages on each database server that you want to access.
2. Specify the package collection for the DB2 packages.
Use the DB2 BIND command to do that.
Related tasks
"Binding SQLJ applications to access multiple database servers"
"Preparing Java routines with SQLJ clauses to run from a JAR file" on page 188
"Preparing Java routines with SQLJ clauses and no JAR file" on page 190
Related reference
"sqlj - SQLJ translator" on page 392
"db2sqljcustomize - SQLJ profile customizer" on page 395
"db2sqljbind - SQLJ profile binder" on page 407
Do not re-customize the serialized profiles. Customization stores a new package
timestamp in the serialized profile, which makes the new serialized profile
incompatible with the original package.
You can use one of the following methods to bind the additional DB2 packages:
v Run the db2sqljbind command against each of the database servers.
v Run the DB2 BIND PACKAGE command with the COPY option to copy the
original packages to each of the additional database servers.
You might need a different qualifier for unqualified DB2 objects on each of the
database servers. In that case, you need to specify a value for the QUALIFIER
bind option when you bind the new packages. If you use the db2sqljbind
command, you specify the QUALIFER option in the -bindoptions parameter,
not in the -qualifier parameter. The -qualifier parameter applies to online
checking only.
By default, when an SQLJ application runs, the DB2 database server looks for
packages using the collection ID that is stored in the serialized profile. If the
collection ID for the additional DB2 packages that you create is different from
the collection ID in the serialized profile, you need to override the collection ID
that is in the serialized profile. You can do that in one of the following ways:
v Specify the collection ID with the pkList DataSource property or the
db2.jcc.pkList global property.
v Follow these steps:
a. Bind a plan for the application that includes the following packages:
– The package collection that you bound in the previous step
– The IBM Data Server Driver for JDBC and SQLJ packages
b. Specify the plan name in the planName DataSource property or the
db2.jcc.planName global property.
Binding a plan might simplify authorization for the application. You can
authorize users to execute the plan, rather than authorizing them to execute
each of the packages in the plan.
Chapter 6. Preparing and running JDBC and SQLJ programs
185

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents