In the ideal environment, you run the application that is enabled with pureQuery client optimization, capture SQL data, and test the execution of the SQL statically running in an environment that is identical to the production environment. However, having identical test and production environments might not be possible. For example, test systems might use DB2® for Linux, UNIX and Windows, while the production environment uses DB2 for z/OS®.
When migrating an application that is enabled with pureQuery client optimization, you might be required to change characteristics of the DB2 packages such as the package and collection names that are in the pureQueryXML file. After you run the Configure utility on the pureQueryXML file with production-specific options, you can use the StaticBinder utility to create the packages in the production database and bind the packages to the database.
You also migrate the pureQuery Runtime properties and pureQueryXML data to be used in the production environment. You might need to modify the finalRepositoryProperties property, the captureMode property, and the allowDynamicSQL property.
If you use a repository, you also create a repository in the production environment, create the runtime group version for the application, and upload pureQuery Runtime property information and the pureQueryXML file to the repository.
In the previous tasks in the scenario, you configured an application with pureQuery client optimization on a test system. After testing is completed, you now want to bind the SQL statements in the pureQueryXML file to the production database. The following examples assume that the production collection is PRODCOL and QUALIFIER PROD. Accordingly, you will update the data source with the correct packagePath setting so that the packages are recognized. Also, the examples in this topic assume that the production database uses the package name PRODPKG package naming convention.
java com.ibm.pdq.tools.ManageRepository -extract runtimeGroup -repositoryDriverClass com.ibm.db2.jcc.DB2Driver -repositoryURL "jdbc:db2://testserver.test.com:32706/sample" -repositoryUsername "myuser" -repositoryPassword "mypwd" -runtimeGroupId testApp -runtimeGroupVersion V2 -outputDirectory C:\TEMP\out –pureQueryXml prodApp.pdqxml
After you retrieve the file, you run the pureQuery Configure and StaticBinder utilities on the pureQueryXML file with the appropriate options.
java com.ibm.pdq.tools.Configure -pureQueryXml prodApp.pdqxml –validateXml true –collection PRODCOL -rootPkgName PRODAPPL -cleanConfigure true
java com.ibm.pdq.tools.StaticBinder –url jdbc:db2://prodserver.prod.com:446/STLEC1” -username "myuser" -password "mypwd" -isolationLevel CS -bindOptions "QUALIFIER PROD" -pureQueryXml prodApp.pdqxml -showDetails true
When you specify the option -showDetails true, the StaticBinder utility displays summary information regarding the DB2 packages that it produces.
The StaticBinder option -isolationLevel CS specifies that the StaticBinder create a single package with isolation level cursor stability (CS). The CS isolation level is the default level for DB2 for Linux, UNIX and Windows databases.
The StaticBinder utility is beginning to bind the pureQueryXml file capture.xml. Starting to process options : -username "*****" -password "*****" -url "jdbc:db2://prodserver.prod.com" -pureQueryXml prodApp.pdqxml -isolationLevel "CS" -bindOptions "QUALIFIER PROD" The StaticBinder utility successfully bound the package 'PRODAPPL2' for the isolation level 'CS'.
When migrating an application to a production environment, static SQL identification information such as consistency tokens and package versions might require changes.
Example
At run time, if the WebSphere JDBC provider custom property currentPackageSet is not set to PRODCOL1B on the WebSphere Application Server data source, the collection PRODCOL in the pureQueryXML file is used. The package will not be found on STLEC1B and SQLCODE 805 will be returned to the application.
If you have dynamic SQL statements, then you must specify the data source property currentPackagePath. If JDBC dynamic packages are bound to collection NULLID you need to set the value of the currentPackagePath property on the WebSphere Application Server data source to PRODCOOL1B,NULLID.
Example
If the SQL statements in the pureQueryXML file are bound to a location for testing, for example, STLEC, with the collection PRODCOL. You can use the BIND COPY command to COPY the package to the production location STLEC1B with collection PRODCOL1B