The following steps can be applied to WebLogic 9.2. These instructions apply to applications that leverage the WebLogic Data Source database connectivity framework, which is the most common (and recommended) method. However, if the application code bypasses the WebLogic framework and connects to a database directly (that is, it instantiates and manages the JDBC driver and connections on its own), use the instructions provided in JDBC Configuration for Standalone or Other Application Server Platforms.
WebLogic Environment Setup
- Find the domain library directory for your WebLogic application. This is where the Parasoft JDBC Driver jar file is copied.
For example, thelib
folder for the WebLogic Medical records sample application domain is usually installed under<WEBLOGIC-INSTALL-DIR>\weblogic92\samples\domains\medrec\lib
. If you have created your own domain, it might be something like<WEBLOGIC-INSTALL-DIR>\user_projects\domains\your_domain\lib
. - Modify your
startWebLogic.cmd
(orstartWebLogic.sh
on Linux) script to include the necessary startup parameters. For example, for the Medical records sample application domain, that script would be located under<WEBLOGIC-INSTALL-DIR>\weblogic92\samples\domains\medrec\
. - Above the line that begins with
set DOMAIN_HOME=
add the following (as one line):set JAVA_OPTIONS=%JAVA_OPTIONS% -Dparasoft.virtualize.server.url=http://<VIRTUALIZE-SERVER-HOSTNAME>:9080 -Dparasoft.virtualize.group.id=ParaBank
- Restart WebLogic so that it will load the new jar and have these properties applied.
Creating a New JDBC Data Source
- Log in to the WebLogic server administration console.
- Under the Domain Structure, expand Services > JDBC and click Data Sources.
- Identify the Data Source that is currently used by your application and note the JNDI name that it is set up with (as well as any values set in the Properties field).
Open the Targets tab, uncheck the servers on which the Data Source is deployed, then click Save. Alternatively (or in addition to this action), you might change the JNDI name so that it does not conflict with the same JNDI name that you will be providing to the new JDBC data source.
- Return to the Data Sources section and do the following:
- Click New.
- Under JDBC Data Source Properties, complete Name and JNDI Name with the details from the previous step.
- Set the database type to Other.
- Set the driver to Other.
- Click Next.
- Under Transaction Options, disable the Supports Global Transactions option, then click Next,
Although the driver emulates the JDBC commits APIs, enabling these options has not been fully verified with the Parasoft JDBC Driver. - Under Connection Properties, specify the connection settings for the original database, then click Next.
- Under Test Database Connection, do the following:
- Specify the fully qualified Parasoft JDBC Driver class name. For example:
com.parasoft.xtest.jdbc.virt.driver.JDBCProxyDriver
. See JDBC Driver Implementation Classes for details. - Specify the JDBC connection URL prefixed with the Parasoft JDBC Driver string. For example:
jdbc:parasoft:proxydriver:oracle.jdbc.driver.OracleDriver:@jdbc:oracle:thin:@beast:1521:XE
- Provide any properties that may be needed for your database (from step 3 above).
- (Optional) Provide a test table name (or a full SQL statement prefixed with SQL); this lets you test the data source configuration without having to run a scenario on your application.
- Click Test Configuration. The messages section at the top will indicate the test result. If it succeeds, you will see the following message:
If there is an error, you will see this message with an exception stack trace:
In this case, you can follow any error instructions to correct the configuration or inspect the Parasoft JDBC Driver log file (at the location provided in the log file location property) in order to correct the problem.
Once the test connection succeeds, click Next.
- Specify the fully qualified Parasoft JDBC Driver class name. For example:
- Under Select Targets, specify the servers where the original Data Source were deployed, then click Finish.
- Activate the changes in the top left corner of the page (at the Change Center section).
Alternative Method: Modifying Application Settings To Use the Parasoft JDBC Driver With a Different JNDI Name
This approach can be applied in the cases where you do not want to modify the original data source, perhaps in the cases where the same data source is used by multiple applications and you want to virtualize the database connections for only a specific application. Under these circumstances, you may be able to modify the applications data source JNDI binding through the administrative console.
Deployed applications can be accessed through the Deployments section under the Domain Structure tree.
Locate the desired application module and modify the JNDI name for the JDBC data source that it is using.