Selecting and enabling JDBC data sources in WebSphere® Application Server

For each JDBC data source that you want to record or virtualize, you must use HCL OneTest API to select and enable the data source.

About this task

Each application under test will normally connect to databases using JDBC data sources that are looked up by means of a JNDI reference. You can use HCL OneTest API to view the JDBC data sources that are available in your IBM® WebSphere® Application Server installation.

If you enable JDBC virtualization for WebSphere® Application Server and want to record or virtualize a database management system supported by HCL OneTest API, the following three JDBC data sources are required:
  • The JDBC data source for connecting to the live database. This data source is not created automatically, so you must create it manually in WebSphere® Application Server.
    Note: For information about manually creating a data source that connects to a live database, see the WebSphere® Application Server information center.
  • The JDBC data source for connecting to the simulation database. Depending on the version of HCL OneTest API and the database management system software that you are using, the data source that connects to the simulation database might be created automatically in WebSphere® Application Server by HCL OneTest API.
    HCL OneTest API version Database management system Data source that connects to the simulation database
    8.5.1 or later IBM® Db2®, Oracle, Microsoft SQL Server, MySQL Created automatically by HCL OneTest API
    Versions earlier than 8.5.1 Db2® Created automatically by HCL OneTest API
    Oracle, Microsoft SQL Server, MySQL Must be created manually in WebSphere® Application Server
  • The HCL OneTest API data source, which is created automatically in WebSphere® Application Server when you enable a WebSphere® Application Server data source in HCL OneTest API for recording or virtualization.
Enabling a JDBC data source reconfigures WebSphere® Application Server so that use of the data source can be recorded and virtualized.
Note: If the JDBC data source that connects to a simulation database is not created automatically for HCL OneTest API and the database management system software, create it manually in WebSphere® Application Server before you can enable it for recording or virtualization.

Procedure

Prerequisites: The JDBC driver must be deployed on each application server that is running WebSphere® Application Server. See, Deploying JDBC proxy into WebSphere Application Server
  1. In HCL OneTest API, click IBM on the Physical View toolbar of the Physical View of Architecture School.
  2. On the IBM menu, click IBM WebSphere Application Server.

    The New IBM WebSphere Application Server window is displayed.

  3. Specify the WebSphere® Application Server host name and the port to connect to. Click Test Transport to test the connection to WebSphere® Application Server.
  4. Click the Data Sources tab.

    The data sources that are configured on WebSphere® Application Server are displayed.

  5. Select the data source for which you want to enable SQL recording and database stubbing and click Enable GH JDBC Driver.

    Alternatively, to stop SQL recording and database stubbing for the selected data source, click Disable GH JDBC Driver.

    Note: If you need to create a data source that connects to a simulation database:
    • Select the data source that you configured to connect to the simulation database.
    • If the HCL OneTest API project contains more than one database, a confirmation prompt is displayed.
    • Select the database that you want to enable for SQL recording and database stubbing.
    • Select the connection string that matches the data source that you want to enable for database recording.
    Note: If you are using HCL OneTest API with WebSphere® Application Server Network Deployment:
    • Ensure that the Config tab contains connection settings for the relevant deployment manager if you are using federated servers and one or more deployment managers.
    • The Scope column on the Data Sources tab indicates the scope (cell, node, or server level) at which each displayed data source is being managed.
    • By having a physical connection to the relevant deployment manager, you can configure data sources at any level in the WebSphere® Application Server hierarchy.

    The Data Source Status column refreshes to confirm that the selected data source is now enabled (or disabled) for database stubbing.

    To facilitate enabling SQL recording and database stubbing, HCL OneTest API defines two new data sources and renames the original data source in JNDI.
    Note: If you are using HCL OneTest API with WebSphere® Application Server Network Deployment, and try to configure a data source where the JDBC driver is not enabled at the correct level in the hierarchy, an error message is displayed. Clicking OK to close the dialog box displays a message that prompts you to restart all WebSphere® Application Server instances that are impacted by the data source changes. When the instances are restarted, the changes take effect on all those instances.

Results

When an application looks up the specified data source in JNDI, it receives a HCL OneTest API stub data source if the following conditions are met:
  • The application is hosted on the server that is running WebSphere® Application Server
  • The server is using the specified data source
The stub data source looks up connections to the live and simulation databases as needed.