...
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).
...
- 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 hard-coded 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 <original driver fully qualified class name]:@[original name>:@<original driver connection URL]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):Code Block -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.
Info icon false title Special Properties May Be Required If the application uses a
java.sql.DriverManager
to create an instance ofjava.sql.Driver
(as the sample ParaBank application does), setparasoft.virtualize.driver.register.jdbcproxydriver.in.drivermanager
totrue
. This tells the Parasoft JDBC Driver to register itself in the runtime'sjava.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
totrue
. This tells the Parasoft JDBC Driver to use proxied connections (instead of the original connection from the original driver) so it can record, virtualize, etcand so on.- Ensure that these properties are applied by restarting the server or applying them in the manner supported by your server.