Testing Java applications that use JDBC

To enable the JDBC proxy to capture SQL being used by an application, the driver must be loaded into the application JVM.

About this task

To load the driver into the application's JVM, modify the startup parameters of the Java™ application as follows:

Procedure

  1. The JDBC proxy requires a number of supporting files to run. Download and extract the JDBC driver package that is provided with Rational® Test Control Panel. For more information, see Rational Integration Tester tool packages
  2. Copy the files that are listed in the following table from the downloaded JDBCIntercept.zip package to the Java application’s CLASSPATH.

    Alternatively, modify the application’s CLASSPATH to point to the files.

    JDBC / Java version File name Description
    JDBC 4, Java 1.6 com.ibm.rational.rit.jdbcdriver4.jar The JDBC proxy.
    All versions jsqlparser15.jar and antlr-3.4.jar
    Note: The following items are not supported for vendor-specific Oracle SQLs:
    • Oracle-specific DDL statements
    • Custom functions
    • Subqueries
    • PIVOT and UNPIVOT statements
    • Nested tables containing multiple columns or single column of user-defined-types
    • Stubs with nested tables
    Supporting libraries.

    When the application class path loads the driver, the search for the registration.xml file is performed in the same directory as the location of the driver.

    Note: If the container is IBM® WebSphere® Application Server, installation of the driver is performed by means of a set of scripts provided in the downloaded JDBCIntercept packages.
  3. Edit the invocation command line or the system properties within the Java application to modify the jdbc.drivers property as follows:
    -Djdbc.drivers=com.greenhat.jdbc.Driver
    Note: If there is already a –D entry that is specifying drivers, ensure that com.greenhat.jdbc.Driver is listed first and that the other entries appended after are in a colon-separated list.
  4. Edit the server tag in the registration.xml file to the URL of the IBM Rational Test Control Panel installation that is being used.

    For information about modifying this file, refer to Modifying the configuration settings of the JDBC proxy.

  5. Optional: Edit the domain and environment tags in the registration.xml file.

    If these tags are modified, the JDBC Proxy is used only when recording/stubbing within the specified domain and environment.

  6. Run the Java application.
  7. Use Rational Integration Tester and Rational Test Control Panel to control JDBC recording and stubbing. For more information, see Rational Integration Tester reference and Virtualization testing using Rational Test Virtualization Server.

Feedback