The following steps can be applied to application servers versioned from 6.0 and later. These instructions apply to applications that leverage the WebSphere Data Source database connectivity framework, which is the most common and recommend method. However, if the application code bypasses the WebSphere framework and connects to a database directly (i.e., 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.
PrerequisiteTo prepare for the configuration, copy the Parasoft JDBC Driver jar to a location on the application server. You will need to provide WebSphere the path to the driver to through the administrative console. |
The configuration involves:
These steps are intended to create a JDBC provider definition within WebSphere configured with the Parasoft JDBC Driver:
This section explains how to adjust the WebSphere Data Source configuration that is currently being used by the application whose database connection you wish to virtualize.
You will modify the JNDI name of the data source so that you can define a separate new Data Source with that same JNDI name. This will prevent naming conflicts with the existing data source. It also saves you from having to change the application itself (or its deployment configuration) within WebSphere. If more than one deployed application uses that same Data Source definition and you do not want to impact these other applications, see Alternative Method: Modifying Application Settings To Use the Parasoft JDBC Driver With a Different JNDI Name, which explains how to alter the application settings with a different/new Data Source configuration (instead of altering the existing Data Source configuration).
To prepare for the setting adjustment:
To perform the adjustment (using the PlantsByWebSphere sample application [provided with WebSphere] as an example:
Change the JNDI name to a different value, then click Apply. For instance, if the original value was jndi/PlantsByWebSphereDataSource,
it could be changed to jndi/PlantsByWebSphereDataSourceOriginal
.
JNDI Naming TipJNDI names often take a hierarchical directory-like form to indicate subcontexts. For example, if your original Data Source JNDI name is |
Next, you will use WebSphere's New Data Source wizard to create a new Data Source configuration that uses the JDBC Provider you created.
For example, for the PlantsByWebSphere sample application, you could use the following settings:
Related ResourcesFor information about properties specific to the database and JDBC driver that is being virtualized, see Troubleshooting JDBC Driver Issues. |
If Properties are Generated Automatically...Some WebSphere versions might automatically introspect the Parasoft JDBC Driver and generate the available properties. If this happens, delete the description, logWriter, loginTimeout and user properties if they show up. |
These instructions 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. These instructions apply to enterprise applications that can have their data source JNDI bindings modified in the WebSphere through the administrative console.
Open Applications> Enterprise Applications (or Applications> Application Types> Web-Sphere enterprise applications in other versions of WebSphere).
Click the desired application. This is the application that will be reconfigured to use the new Parasoft JDBC Driver data source.
For WebSphere 6.1 and earlierIf the application uses CMP persistence (which in the case with the PlantsByWebSphere example), click “Provide default data source mapping for modules containing 2.x entity beans” and modify the current target resource JNDI name with the JNDI name you provided in Creating a New JDBC Data Source with the Parasoft JDBC Driver (step 2), but prefix it with eis/ and postfix it with _CMP. For example, if you configured the Parasoft JDBC Driver data source with jdbc/ParasoftJDBCDataSource, here you will provide After that, click Map data sources for all 2.x CMP beans and modify the current target resource JNDI name with the JNDI name you provided in Creating a New JDBC Data Source with the Parasoft JDBC Driver (step 2) in the previous section, but prefix and postfix with eis/ and _CMP accordingly. |
JNDI Naming TipJNDI names often take a hierarchical directory-like form to indicate subcontexts. For example, if your original Data Source JNDI name is |