Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

Managing pureQuery-enabled applications efficiently, Part 3: Automate client optimization with WebSphere applications

pureQuery client optimization with SQL management repository

Tony Sun (, Staff Software Engineer, IBM
Tony Sun is the primary QA engineer for the pureQuery runtime product.

Summary:  In a customer environment, applications often interact with transactional databases from within an application server. pureQuery client optimization can provide useful diagnostic information as well as increase performance for your web application. In this tutorial, you will learn how to automate the pureQuery client optimization process with Apache Ant script technologies.

View more content in this series

Date:  19 May 2011
Level:  Intermediate PDF:  A4 and Letter (1033 KB | 24 pages)Get Adobe® Reader®

Activity:  17116 views

Set up the framework environment

Before diving into the automation process, you need to correctly set up the framework environment. This involves configuring the WebSphere environment and creating the correct directory structures.

Configuring the WebSphere environment

Since your application will be deployed inside a WebSphere Application Server, the first step is to configure the WebSphere environment. If you have not worked with WebSphere before, these instructions should provide you with enough information to set up your application to run against a database server. The WebSphere instance may be on your own client machine, or it may be on a separate machine. In this example, the WebSphere instance is on the client machine. If it is on a separate machine, ask your WebSphere administrator to help you complete these steps.

Setting up a data source connection

For your web application to connect to the transactional database, it needs to use a JDBC driver. That JDBC driver must be put on the WebSphere classpath. Set up the JDBC driver:

  1. In the WebSphere panel on the left, click JDBC providers.

    Figure 2. Selecting JDBC providers
    JDBC providers listed in Resources on left panel

  2. Click on DB2® Universal JDBC Driver Provider.

    Figure 3. Selecting the DB2 Universal JDBC Driver Provider
    Shows properties for the JDBC

  3. This will bring up the classpath of the driver. Make sure your IBM JCC drivers and pureQuery drivers are on the classpath. In this case, there is a WebSphere variable defined as $DB2UNIVERSAL_JDBC_DRIVER_PATH, which points to a specific path. You can specify any path you want as long as they point to:
    • pdq.jar (pureQuery Jar)
    • pdqmgmt.jar (pureQuery License)
    • db2jcc.jar (IBM JCC Driver to connect to database)
    • db2jcc_license_ciuz.jar (IBM JCC Driver License)
    • pdq_properties.jar (a properties file that will be used by your application)
      Example: /home/users/lib/pdq.jar or C:/jars/pdq.jar. All these JAR files must exist in a directory that WebSphere can access. For more information on creating a directory for this, see the "Directory structure" section of this tutorial. If WebSphere is maintained on another machine, send the above files to the system administrator and have the administrator place those files on the classpath.

Next, you need to use this newly created JBDC Driver to create a data source.

  1. In the left WebSphere Panel, click Data sources under JDBC.

    Figure 4. Configuring the data source in WebSphere
    Left panel shows resources, including JDBC

  2. Click New to create a new data source.
  3. Enter the data source name you want. In this demo, it is called localhost, and the JNDI name is JDBC/localhost. Click Next.

    Figure 5. Configuration screen for new data source
    Screen where you enter basic data source information

  4. Choose the option Select an existing IBM JDBC Driver, then select the DB2 Universal JDBC Driver Provider that you created earlier and click Next.

    Figure 6. Specifying the JDBC driver
    Selecting an existing JDBC provider

  5. Enter the database connection information and click Next.

    Figure 7. Entering the database connection details
    Driver type, database name, server name, and port number

  6. At this point, you need to create a new security alias (a user ID and password) for this data source. Click on the Global J2C authentication alias link.

    Figure 8. Setting up the security alias
    Security alias screen

  7. Click the New button.

    Figure 9. Setting up a new user identity
    Screen for setting up a new user identity

  8. Provide a name for this alias, and also the user ID and password for the data source that will be used to connect to the database and click Apply.

    Figure 10. Entering the authentication data properties
    fields for entering alias, user ID, password, and optional

  9. Now you can select this authentication alias for your new data source.

    Figure 11. Setting up the security alias
    Select the authentication values for this resource

  10. Go to the next page and click Finish. The newly created data source should be in the list of data source. Select it and click Test connection.

    Figure 12. Testing the connection
    Screen lists various data sources with test connection button at top

  11. You should get a success message.

    Figure 13. Successful connection
    Indicates connection operation was successful

The application

Any WebSphere application that utilizes client optimization can take advantage of this automation process. For the purpose of this tutorial, we have provided a sample application. The file is the only application source and is provided to you in the Download section of the tutorial for demonstration purposes. It is packaged in the Test.war file (a web application archive) that will be deployed into WebSphere. As stated above, you are free to use your own web application archive.

The application runs for a specific period of time determined by the parameters set below.

Listing 1. code
int totalIterations= 10;
long timeForEachIteration= 60000;

The totalIterations variable determines how many times the application will run. The timeforEachIteration is in milliseconds, so the above setup runs the application for one hour.

Deploying the application

The following steps deploy the Test.war file that includes the file. If you are familiar with this process or have another application you want to deploy, you can skip this section.

  1. In the WebSphere navigation panel, expand the drop-down menu: Applications > Application Types > WebSphere Enterprise Applications.

    Figure 14. Enterprise applications in WebSphere
    Welcome screen for applications.

  2. Click Install on the following screen and browse to the folder where the Test.war application is located.

    Figure 15. Path to the new application
    Screen where you specify the path

  3. Click Next and choose Fast Path.

    Figure 16. Method for installing the application
    Choice between fast path and detailed

  4. Keep clicking Next until you reach the screen to map reference to resources. Specify the JNDI name for the data source that the application will connect to. The JNDI data source name points to the data source you created earlier: jdbc/localhost. Click Next.

    Figure 17. Map references to resources
    Each resource references that is defined in your application must be mapped to a resource

  5. Enter the Context Root for the application. The example uses /Test and click Next.

    Figure 18. Map context roots for Web modules
    Context root defined in the deployment descriptor can be edited

  6. Click Finish, then click Save.

    Figure 19. Summary screen of options to install
    Summary screen listing

Directory structure

You need to create a home directory where the all the necessary automation files and client optimization files will be stored. In this example, we use C:\repository.

Figure 20. Repository directory
Shows repository folder

The extract folder holds files extracted from the repository.

The upload folder contains pureQuery Runtime property files that will be used by the WebSphere application and also by the repository. It contains:

  • file — This file is uploaded to the repository and will be loaded by the application during automatic pull-down.
  • — This file is copied over and placed in the classpath of the WebSphere application server. It contains the pureQuery pdq.finalRepositoryProperties property that points to the repository. If WebSphere is on a remote machine, you will need to copy this file manually to the remote machine.
  • and — These files will override if you want to switch from dynamic capture to static execution.

The HTTP folder holds files returned by any HTTP requests by the application. The capture folder holds all the captured XML files produced from client optimization. The next directory holds all the WebSphere JAR files.

Figure 21. WebSphere JAR file directory
Image shows listing of JAR files

As mentioned in the WebSphere configuration section, the above-highlighted JAR files need to be included in the WebSphere classpath. Ensure that these files exist. The file pdq_properties.jar is just an archive file that contains The properties file is in a JAR file so WebSphere can pick up the properties. If WebSphere is on your local machine, the automation system will copy over and archive it as pdq_properties.jar. If WebSphere is on a remote machine, you will manually need to issue jar -cvf pdq_properties.jar and place the machine on the remote WebSphere classpath. Ask your WebSphere administrator to do this on the machines that the administrator maintains.

2 of 8 | Previous | Next


Zone=Information Management, WebSphere, Open source
TutorialTitle=Managing pureQuery-enabled applications efficiently, Part 3: Automate client optimization with WebSphere applications