16.10.2015 Views

Getting Startedwith pureQuery

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

126<br />

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

-<strong>pureQuery</strong>Xml<br />

"C:\pathOfWorkspace\<strong>Getting</strong>StartedWithPureQuery\<strong>pureQuery</strong>Folder\captureFile.pdqxml"<br />

Listing 6.8 - The command to bind the <strong>pureQuery</strong>Xml file with the options that are<br />

listed in Default.bindProps<br />

6.8 Running an application while specifying a <strong>pureQuery</strong>Xml file<br />

When you have a <strong>pureQuery</strong>Xml file that you have configured and possibly used for a bind,<br />

you can direct <strong>pureQuery</strong> to use it while your application is executing. Use the <strong>pureQuery</strong><br />

property pdq.<strong>pureQuery</strong>Xml to specify the path of the <strong>pureQuery</strong>Xml file that <strong>pureQuery</strong><br />

should use during execution. The path can indicate the location of the file on the disk, or it<br />

can indicate the location of the file in an archive file that is in the classpath. Use <strong>pureQuery</strong><br />

properties to indicate what you want <strong>pureQuery</strong> to do during execution.<br />

6.8.1 Static execution<br />

Possibly the most common reason for specifying a <strong>pureQuery</strong>Xml file during execution is to<br />

have SQL statements execute statically. You can set the value of the <strong>pureQuery</strong> property<br />

pdq.executionMode to either STATIC or DYNAMIC. Set it to the value STATIC to direct<br />

<strong>pureQuery</strong> to execute statically the statements in the <strong>pureQuery</strong>Xml file that have both<br />

statement-set level and statement-level isBindable attributes set to the value true.<br />

You can set the property pdq.allowDynamicSQL to dictate what <strong>pureQuery</strong> does when<br />

the application attempts to execute statements that are not in the <strong>pureQuery</strong>Xml file. This<br />

property also determines what <strong>pureQuery</strong> does when the application attempts to execute<br />

statements that are in the <strong>pureQuery</strong>Xml file with an isBindable attribute set to false.<br />

The value TRUE is the default, and it directs <strong>pureQuery</strong> to execute the statements<br />

dynamically. The value FALSE directs <strong>pureQuery</strong> to throw exceptions instead of executing<br />

the statements. Some SQL statements cannot be bound. If your application needs to<br />

execute any such statements, you must either set the property pdq.allowDynamicSQL to<br />

the value TRUE or you must leave the property unset.<br />

6.8.2 Captured-only execution<br />

You can use the captured-only feature to restrict the SQL statements that your application<br />

can execute, regardless of whether they are bound in the database. The SQL statements<br />

in your <strong>pureQuery</strong>Xml file provide a whitelist of SQL statements that you allow, and<br />

<strong>pureQuery</strong> blocks the execution of all other SQL statements. This allows you to improve<br />

the security of applications that contain SQL statements that are not bound. It also helps<br />

you to improve the security of your application in environments where you are not using<br />

static SQL, such as in an environment in which you are using a database other than the<br />

IBM DB2 Database. Set the <strong>pureQuery</strong> property pdq.capturedOnly to the value TRUE<br />

to use this feature. The default value is FALSE.

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

Saved successfully!

Ooh no, something went wrong!