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:
- Copy the Parasoft JDBC Driver jar file into a location that your application can access.
- 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 hardcoded 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 tocom.parasoft.xtest.jdbc.virt.driver.JDBCProxyDriver
, and edit the JDBC connection URL used by your application tojdbc:parasoft:proxydriver:<original driver fully qualified class name>:@<original driver connection URL>
. For example, if the original JDBC connection URL wasorg.hsqldb.jdbcDriver:@jdbc:hsqldb:hsql://localhost/parabank
, then change it tojdbc:parasoft:proxydriver:org.hsqldb.jdbcDriver:@jdbc:hsqldb:hsql://localhost/parabank
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.
- Ensure that these properties are applied by restarting the server or applying them in the manner supported by your server.