After you create and bind DB2® packages
that contain the captured SQL statements, you can run your non-pureQuery
API application so that is uses static SQL.
Procedure
To run a non-pureQuery API application so that captured
SQL statements run statically:
- Provide access to the static packages that both the application
and the IBM® Data Server Driver for JDBC and SQLJ need. If the SQL statements for your application are bound in the
collection in which the packages for the driver are located, you do
not need to perform this step.
- If your application uses DataSource-based Connection objects: Configure
the DB2BaseDataSource object's currentPackagePath property to contain
the IDs for the collection in which the application's SQL statements
were bound, and the IDs for the collection that contains the packages
for the IBM Data Server Driver for JDBC and SQLJ.
- If your application uses DriverManager-based Connection
objects:
- If the application creates a single Connection object, try setting
the currentPackagePath property for the IBM Data Server Driver for JDBC and SQLJ with
a JVM system property.
- If the application creates multiple distinct Connection objects
that are each associated with a pureQueryXML file that contains SQL
statements that were bound in a unique collection, set the currentPackagePath
property to include all necessary collection IDs.
- If the application creates any of the following objects, you might
need to change your application before it can run statically:
- Multiple distinct Connection objects that are each associated
with a pureQueryXML file that contains SQL statements that were bound
in a unique collection
- Multiple distinct Connection objects that explicitly set the currentPackagePath
or currentPackageSet in the application with values in the properties
portion of a URL
- Multiple distinct Connection objects that meet both of the previous
two criteria
- Set the properties for running captured statements statically. See Required settings for running non-pureQuery API applications in STATIC mode.
- Run your non-pureQuery API application.