Establishing a JDBC connection with HCL OneTest Data

You must establish a connection between HCL® OneTest Data and the JDBC supported database to generate the schema and to write the generated test data in the database.

Before you begin

You must have created a sample schema in the database. See Creating a sample schema in a database.

Procedure

  1. Log in to HCL OneTest Server and open the team space that contains your project.
  2. Open your project.
    The Overview page is displayed.
  3. Click Author > Data Fabrication.
    The Data Fabrication page is displayed.
  4. Click New from the Connections tab to create a new connection.
  5. Select JDBC as a connection type and click Next.
  6. Enter the following properties of the connection in the Properties dialog.
    1. Enter the URL of the database.

      You must provide the URL in the following format:

      jdbc:<DatabaseType>://<HostName/IPAddress>:<PortNumber>/<CustomSettings>

      For example, the URL for a MySQL database server can be jdbc:mysql://10.0.2.15:8081 or for a Microsoft SQL database Server can be jdbc:sqlserver://10.134.59.16:1433.

      Notes:
      • When you want to establish a connection with IBM DB2, you must provide the database name as the <CustomSettings>.

        For example, the URL for IBM DB2 can be jdbc:db2://10.134.59.16:50000/testdb.

      • When you want to establish a connection with an Oracle database, you must enter details in the following format:

        jdbc:<DatabaseType>:<client_Type>//<HostName/IPAddress>:<PortNumber>:<ServiceID/Service_Name>

        For example, jdbc:oracle:thin:@10.543.89.22:1521:ORCLCDB.

        You can get the details of the service ID or service name from the properties of the Oracle database that you set up.

    2. Enter the name and password to access the database.
  7. Click Test to verify whether the connection is established successfully.
    Note: If the connection fails to establish, it can be because of any of the following reasons:
    • Mismatch in the version of the drivers.
    • Unreachable database.
    • Missing database.
    • Unsuccessful copying of the connector jar file.

    You can run the following command to check the logs of HIP Server to get more information about the reason of failure:

    kubectl logs {my-ots}-hip-server-0 -n test-system

Results

You have successfully established the connection between HCL® OneTest Data and the database.

What to do next

You must provide a name for the connection, and then generate a schema. See Generating a schema in HCL OneTest Data.