16.10.2015 Views

Getting Startedwith pureQuery

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

114<br />

<strong>Getting</strong> Started with <strong>pureQuery</strong><br />

ON for the property pdq.captureMode, and the value DYNAMIC for the property<br />

pdq.executionMode.<br />

# This is a comment.<br />

pdq.<strong>pureQuery</strong>Xml=C:\\path\\captureFile.pdqxml<br />

pdq.captureMode=ON<br />

pdq.executionMode=DYNAMIC<br />

Listing 6.1 - An example of specifying <strong>pureQuery</strong> properties in a properties file<br />

As will be described later, you must specify <strong>pureQuery</strong> properties to use Client Optimizer<br />

functionality. The <strong>pureQuery</strong> properties must be specified when your application creates<br />

java.sql.Connection objects. If they are not, the application uses standard JDBC<br />

functionality.<br />

Refer to the IBM Optim <strong>pureQuery</strong> Runtime documentation for a complete list of the<br />

<strong>pureQuery</strong> properties, along with information about their use.<br />

6.5 Capturing SQL statements<br />

The first step in using the Client Optimizer is to capture all of the SQL statements in the<br />

application into a <strong>pureQuery</strong>Xml file. You tell <strong>pureQuery</strong> to capture SQL statements by<br />

setting certain properties in the <strong>pureQuery</strong> properties. <strong>pureQuery</strong> captures each SQL<br />

statement only once. <strong>pureQuery</strong> considers two SQL statements to be the same if the text<br />

of the SQL is identical (including capitalization and white space) and they have identical<br />

execution characteristics. Additionally, <strong>pureQuery</strong> only captures SQL statements that a<br />

JDBC application executes successfully. Therefore, if an application prepares a statement<br />

without executing it, or if an application attempts to execute an SQL statement but the<br />

execution fails, <strong>pureQuery</strong> will not capture that statement.<br />

If you want <strong>pureQuery</strong> to capture all of the SQL statements that your application executes,<br />

clearly your application needs to successfully execute all of the statements while you are<br />

performing the capture. Usually, the easiest way to do this is to direct <strong>pureQuery</strong> to<br />

capture during the execution of the tests of your application. You can capture SQL<br />

statements incrementally; that is, if you capture SQL statements into a <strong>pureQuery</strong>Xml file,<br />

you can later capture again, specifying the same <strong>pureQuery</strong>Xml file. If you do this,<br />

<strong>pureQuery</strong> simply adds the newly captured SQL statements to your existing <strong>pureQuery</strong>Xml<br />

file. You can even capture during static execution, if you set the <strong>pureQuery</strong> properties<br />

correctly.<br />

If you capture SQL statements to create a <strong>pureQuery</strong>Xml file, and then you modify your<br />

application, IBM recommends that you delete your <strong>pureQuery</strong>Xml file and capture again to<br />

replace it. Otherwise, your <strong>pureQuery</strong>Xml file can become bloated with information about<br />

SQL statements that your application no-longer executes, as well as inaccurate information<br />

about which parts of your application execute certain SQL statements.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!