This section applies if the application that uses the JDBC driver you wish to virtualize is either:

  • A standalone Java application, or
  • A Java application that is deployed in application servers that do not manage data source configurations.

In such cases, the Parasoft JDBC Driver can be used and controlled via system properties (if the generic java.sql.Driver class implementation is used), or via the driver properties (if another implementation is used).

To do this:

  1. Copy the Parasoft JDBC Driver jar file into a location that your application can access.
  2. Alter the application’s JDBC connection configuration to use the Parasoft JDBC Driver instead of the current database vendor driver.
    • The steps might vary depending on how the JDBC access is configured in the application or the framework that it is deployed at. For example, it might require changing code if it is hard-coded into the application code, or modifying some properties file or a descriptor file that specifies the JDBC connection configuration.
    • If a driver class which extends java.sql.Driver is used by the application, then modify the driver class name to com.parasoft.xtest.jdbc.virt.driver.JDBCProxyDriver, and edit the JDBC connection URL used by your application to
      jdbc:parasoft:proxydriver:[original driver fully qualified class name]:@[original driver connection URL]. For example, if the original JDBC connection URL was org.hsqldb.jdbcDriver:@jdbc:hsqldb:hsql://localhost/parabank, then change it to jdbc:parasoft:proxydriver:org.hsqldb.jdbcDriver:@jdbc:hsqldb:hsql://localhost/parabank
  3. If an implementation of java.sql.Driver is used, then add the required properties to the system properties definition.
    For example, in Tomcat servers, edit catalina.sh or catalina.bat (depending on the platform). Add the following command line arguments to the Java executable startup arguments list (with no line breaks):

    -Dparasoft.virtualize.server.url=http://[virtualize server host name]:9080 -Dparasoft.virtualize.group.id=parabank 
    -Dparasoft.virtualize.driver.register.jdbcproxydriver.in.drivermanager=true

    Be careful about introducing spaces or new lines into this one-line string set of arguments. Also note that some application servers provide variables that can be edited (or have these arguments appended to them) in order to facilitate managing such changes.

    Special Properties May Be Required

    If the application uses a java.sql.DriverManager to create an instance of java.sql.Driver (as the sample ParaBank application does), set parasoft.virtualize.driver.register.jdbcproxydriver.in.drivermanager to true. This tells the Parasoft JDBC Driver to register itself in the runtime's java.sql.DriverManager using the DriverManager.registerDriver() method.

    If the application will use the driver directly by creating a new instance of the JDBC driver and then calling the connect method on the driver, then set parasoft.virtualize.driver.proxy.direct to true. This tells the Parasoft JDBC Driver to use proxied connections (instead of the original connection from the original driver) so it can record, virtualize, etc.

  4. Ensure that these properties are applied by restarting the server or applying them in the manner supported by your server.
  • No labels