This section covers how to configure the Parasoft JDBC Driver for Tomcat. Configuration for Tomcat can be achieved via data source configuration or java.sql.Driver configuration. The best approach depends on how your application is configured.
Data Source Configuration
To configuring a Tomcat Data Source to use the Parasoft JDBC Driver:
- Copy the Parasoft JDBC Driver jar file to the global
libdirectory that is directly under
- Edit each
context.xmlfile that contains the resource definition for the data source as follows (there may be several
context.xmlfiles to edit since they can be found in
webappsas well as at the global config level):
typeto the class name of the Parasoft Data Source you are going to use. The available values depend on the database vendor JDBC driver currently in use. See JDBC Driver Implementation Classes for details.
factoryand set it to
The required properties (
virtualizeServerUrl) are set on the resource as well. No system properties are needed.
Do not change any fields starting with
url, name, user,and
password). In the above case, the
urlfield might be set to
Alternative Method: Calling the Original Data Source
You can call the original data source if it would be easier for you to reference the existing data source (e.g., if you have many options set) or if you are using a custom data source factory.
To configure a Tomcat Data Source to call the original data source:
- Copy the Parasoft JDBC Driver jar file to the global lib directory that is directly under tomcat root.
- In the server.xml or context.xml file, add a new resource with information to call the original data source.
- Modify the name of this resource to be the JNDI data source name that the AUT will call. This should be the name of the original data source. You can modify the original data source’s name to something like jdbc/nameLIVE [user defined].
- Add an attribute called targetDataSource. This will be the original data source and JNDI name. This is how the new datasource will call the original data source.
- Add a factory and set it to com.parasoft.xtest.jdbc.virt.driver.ParasoftDataSourceFactory.
- Set virtualizeServerUrl and virtualizeGroupId.
For example, assume you have this original data source:
Here is the equivalent Parasoft data source:
- The required properties (virtualizeGroupId and virtualizeServerUrl) are set on the resource as well. No system properties are needed.
- A recommended best practice is to add virtualizeServerPath to indicate which Virtualize server path the driver will send request information to. Once your asset is created, you will need to deploy it on that same path. This allows you to send data only to this single asset.