The workbench provides features for capturing SQL statements
from applications that run against DB2®, Informix® Data Server, and Oracle
data sources. You can use pureQuery to ensure that an application
runs only the SQL statements that you captured.
About this task
To run only the SQL statements that are captured
in a pureQueryXML file:
Procedure
- Enable pureQuery to capture the SQL statements that are
in your application.
- If your Java project
does not yet support pureQuery, right-click your Java project and select Data Access
Management and then click either Add Data Access
Management Support or Add pureQuery Support.
Follow the steps in the Add Data Access Management Support wizard.
For information about the controls on the wizard, click
in
the lower-left corner of the wizard. If the help does not appear,
select a control on the Add pureQuery Support page
and then click
again.
- If your Java project
already supports pureQuery, follow these steps to ensure that you
can capture SQL statements:
- Right-click your Java project
and select Properties.
- In the Properties dialog, select the pureQuery page.
- Select the Enable SQL capturing for JDBC applications check
box.
- In the Location for pdq.properties file
field, browse to select the pdq.properties file in the project for
your application. If you do not yet have such a file, the workbench
creates one for you in the folder that it displays in the field.
- Optional: Create JUnit tests for your non-pureQuery
API application that run all of the SQL statements that you want to
capture. If you do not create unit tests, you must run
the application so that it executes all of the SQL statements that
you eventually want to run statically.
For information about JUnits
in the workbench, see Writing and running JUnit tests.
- Capture SQL statements.
When you are
setting values for the relevant properties, ensure that the property pureQueryXml, outputPureQueryXml,
or both are set to dataAccessFolder/file-name.
If you do not set a value, the workbench uses dataAccessFolder/capture.pdqxml.
For the workbench to recognize the pureQueryXML file, the file must
be in the dtatAccessFolder folder in your Java project.After you set the
values for the properties, run your application or your JUnit tests.
After
you are finished, the workbench creates in your Java project the pureQueryXML files that you
specified. You can repeat this step if you did not capture all of
the SQL statements in your application and want to capture the rest
of them.
- Optional: Edit or merge the pureQueryXML files that you created.
- Run
your application with the pureQueryXML files that contain the SQL
statements that you have approved.