2. Connect the JDBC Virtual Service to an Existing Database

Applies to ReadyAPI 3.7, last modified on April 08, 2021

The JDBC virtual service you created does not have any data. In ReadyAPI, you record JDBC virtual services by having them act as a proxy that routes JDBC requests to the database and stores transactions. Here, we will connect the virtual service to a database:

  1. In the Route Options drop-down, select Route and Record Non-Virtualized Request:

    JDBC service virtualization and database testing: Enable routing

    Click the image to enlarge it.

    In this mode, when you send requests to the virtual service, it will redirect them to the specified database and record the transaction. If a request is already recorded, the service will return the stored response.

  2. Enter the database connection string in the Route to text box.

    ReadyAPI uses JDBC drivers to connect to the database. The installation package includes the drivers for the most popular databases. If the driver for your database is not provided, install it to <ReadyAPI>/bin/ext and restart ReadyAPI.

    The connection string depends on the database provider you use, for example, for a MySQL database, your connection string may look like this:

    jdbc:mysql://localhost:3306/world

    JDBC service virtualization and database testing: Database connection string

    Click the image to enlarge it.

  3. Specify the user credentials ReadyAPI will use to log in to the database. You can do this in two ways:

    • In the User name and Password text boxes. When you use these text boxes, ReadyAPI inserts user credentials into the connection string automatically. It also masks the text you enter in the Password field to make it secure:

      JDBC service virtualization and database testing: User credentials

      Click the image to enlarge it.

    – or –

    • In the connection string. The position where you enter user credentials depends on the database provider and the driver.

  4. When you have the correct connection string and user credentials, start the virtual service.

    ReadyAPI will try to connect to the database. If it fails to connect, it will display an error.

After you have a virtual service set up and running, you need to send JDBC requests to it to record them. The next step of the tutorial describes how to do this from ReadyAPI.

Prev          Next

See Also

Tutorials and Samples

Highlight search results