Example ManageRepository commands

Use the ManageRepository utility to connect to a database and create a repository that can store pureQuery configuration information, and data from a pureQueryXML file. The repository can also store captured SQL when using pureQuery client optimization.

The ManageRepository utility can create a repository in a supported database. You can also use ManageRepository or the workbench to manage a repository.

Examples

The following examples creates a repository:
java com.ibm.pdq.tools.ManageRepository 
  -create repository
  -repositoryType pureQueryOnly
  -repositoryURL jdbc:db2://test.user.com:17593/SAMPLE 
  -repositoryUsername testid 
  -repositoryPassword testpwd 
  -repositoryDriverClass com.ibm.db2.jcc.DB2Driver
Note: The connection options repositoryURL, repositoryUsername, repositoryPassword, and repositoryDriverClass are needed to connect to database. In some of the following examples, the set of connection options are shortened to <connection options> for clarity.

The following example generates a DDL script that can be used to create a repository. The repository is not created.

java com.ibm.pdq.tools.ManageRepository
  -create repository
  -repositoryType pureQueryOnly
  <connection options>
  -generateScriptOnly "c:\create.ddl"

Create a repository to store only pureQuery runtime data

If the repository will only be used to contain the pureQueryXML file used by pureQuery client optimization, a smaller, simpler version of the repository can be created. Use the -repositoryType option with the pureQueryRuntimeOnly value.
java com.ibm.pdq.tools.ManageRepository 
    -create repository
    -repositoryType pureQueryRuntimeOnly
    <connection options>

Create packages to access the repository

After the repository is created, for database platforms that support static SQL, database packages can be created to govern access to the repository.

Collection name and package names will be chosen by the utility and is not modifiable by the user.
java com.ibm.pdq.tools.ManageRepository
    -bind packages 
    <connection options>
If the user specifies the -generateScriptOnly option, the ManageRepository utility only create the command script necessary to bind the SQL statement that manage the repository. The bind is not performed.

Update pureQueryXML data with captured SQL data

The following example assumes that all the pureQuery data is stored in a single repository: the pureQuery data, the pureQueryXML file, the pureQuery properties file, the captured SQL files, the configuration files used for merging, and the properties file for binding. The following command extracts all the data into files on your local system.
java com.ibm.pdq.tools.ManageRepository 
      -extract runtimeGroup
      -outputDirectory "c:\mergeDir"
      -pureQueryXml "capture.pdqxml"
      -optionsFileForBind "bind.properties"
      -optionsFileForConfigure "gen.properties"
      -pureQueryProperties "pdq.properties"
      -incrementalCapture "testcap"
      -runtimeGroupId "SampleId"
      -runtimeGroupVersion "3.1"
       <connection options>
The captured SQL data is extracted to files with the names testcap_N.pdqxml where N is an integer starting with 1.
Note: To update the pureQueryXML data for a runtime group version, not all the extracted files are required for the Merge, Configure, and StaticBinder utilities to work. However, keeping the pureQuery files as a set either on your system or in a repository, makes managing the files easier.

The following command removes the captured SQL data from the runtime group version after comparing the captured SQL with the captured SQL data in the files to ensure that the captured SQL in the repository has not changed.

java com.ibm.pdq.tools.ManageRepository 
    -delete incremental
    -inputDirectory "c:\mergeDir"
    -runtimeGroupId "SampleId"
    -runtimeGroupVersion "3.1"
    -incrementalCapture "testcap"
    <connection options>
After updating the configuration information as needed and performing a merge, configure, and bind, use ManageRepository -update runtimeGroup to upload the pureQuery information into a repository. In this example the version ID has been changed to create a new version of the runtime group data.
java com.ibm.pdq.tools.ManageRepository 
      -update runtimeGroup
      -inputDirectory "c:\mergeDir"
      -pureQueryXML "capture.pdqxml"
      -bindProps "bind.properties"
      -genProps  "gen.properties"
      -pdqProperties "pdq.properties"
      -runtimeGroupId "SampleId"
      -version "3.2"
       <connection options>

Activating a runtime group version

The following command actives the new runtime group version.
java com.ibm.pdq.tools.ManageRepository 
    -activate runtimeGroup
    -runtimeGroupId "SampleId"
    -runtimeGroupVersion "3.2"
    <connection options>

Specifying a connection to a separate repository containing captured SQL data

The captured SQL data from an application using pureQuery client optimization can be stored in a different repository than the pureQueryXML data. You can specify both repositories and extract the captured SQL data when you extract the pureQueryXML data.

The following ManageRepository command uses the extract option and two sets of connection options, the repository* properties and the incrementalRepository* properties. The repository* connection options specify a connection to the repository containing the pureQueryXMLdata. The incrementalRepository* properties specify a connection to the repository containing the captured SQL data. The command uses the runtime group version specified by the runtimeGroupId and version options when extracting the pureQuery data and the captured SQL data. The pureQuery data is in the repository specified by the repository* connection options and the captured SQL data is in the repository specified by the incrementalRepository* connection options.
java com.ibm.pdq.tools.ManageRepository 
      -extract runtimeGroup
      -outputDirectory "c:\mergeDir"
      -pureQueryXML "capture.pdqxml"
      -bindProps "bind.properties"
      -genProps  "gen.properties"
      -pdqProperties "pdq.properties"
      -incrementalCapture "testcap"
      -runtimeGroupId "SampleId"
      -version "3.1"

      -repositoryURL jdbc:db2://test.user.com:17593/SAMPLE 
      -repositoryUsername testid 
      -repositoryPassword testpwd 
      -repositoryDriverClass com.ibm.db2.jcc.DB2Driver

      -incrementalRepositoryURL=jdbc:db2://test.capture.com:18588/CAPTURE 
      -incrementalRepositoryUsername=testsqlcap
      -incrementalRepositoryPassword=testsqlcappwd
      -incrementalRepositoryDriverClass=ccom.ibm.db2.jcc.DB2Driver
      -incrementalRepositorySchema=PQCAPTURE
Note: The incrementalRepository connection options are used only with the -extract runtimeGroup option to extract captured SQL from repository.

Compare two pureQueryXML files

The following command compares two pureQueryXML files and stores the report in the file c:\pureQuery\testEnv\pdqChanges\demo.html.
java com.ibm.pdq.tools.ManageRepository
    -report pureQueryXMLChanges 
    -oldPureQueryXml c:\pureQuery\testEnv\pdqArtifacts\demo.pdqxml.org 
    -newPureQueryXml c:\pureQuery\testEnv\pdqArtifacts\demo.pdqxml
    -file c:\pureQuery\testEnv\pdqChanges\demo.html
    -repositoryURL jdbc:db2://test.user.com:17593/SAMPLE 
    -repositoryUsername testid 
    -repositoryPassword testpwd
    -repositoryDriverClass com.ibm.db2.jcc.DB2Driver 
A connection to a database is required.

Feedback