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.
To configuring a Tomcat Data Source to use the Parasoft JDBC Driver:
lib directory that is directly under tomcat root.webapps as well as at the global config level):type to 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.factory and set it to com.parasoft.xtest.jdbc.virt.driver.ParasoftDataSourceFactorySet virtualizeServerUrl and virtualizeGroupId.
For example:
<Resource name="<original name>" auth="<original auth>" type="com.parasoft.xtest.jdbc.virt.driver.oracle.OracleDataSource" factory="com.parasoft.xtest.jdbc.virt.driver.ParasoftDataSourceFac-tory" virtualizeGroupId="hibernateOracle" virtualizeServerUrl="http://localhost.parasoft.com:9080" user="<original user>" password="<orignal password>" url="<original url>"/> |
The required properties (virtualizeGroupId and virtualizeServerUrl) are set on the resource as well. No system properties are needed.
Do not change any fields starting with original (including url, name, user, and password). In the above case, the url field might be set to jdbc:oracle:thin:@//host:1521/db
See JDBC Configuration for Standalone or Other Application Server Platforms.
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:
lib directory that is directly under tomcat root.jdbc/nameLIVE [user defined].targetDataSource. This will be the original data source and JNDI name. This is how the new datasource will call the original data source.factory and set it to com.parasoft.xtest.jdbc.virt.driver.ParasoftDataSourceFactory.virtualizeServerUrl and virtualizeGroupId.For example, assume you have this original data source:
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource name="jdbc/mysqlDBlive" auth="Container"
type="javax.sql.DataSource"
username="12345" password="xxxxx"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://boa.parasoft.com:3306/test"
maxActive="8"/> |
Here is the equivalent Parasoft data source:
<Resource name="jdbc/mysqlDB" auth="Container"
factory="com.parasoft.xtest.jdbc.virt.driver.ParasoftDataSourceFactory"
targetDataSource="jdbc/mysqlDBLive"
virtualizeServerUrl="http://localhost:9080"
virtualizeGroupId="tomcat-target-data-source"
virtualizeServerPath="somePath"
/>
</Context> |
Notes:
virtualizeGroupId and virtualizeServerUrl) are set on the resource as well. No system properties are needed.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.