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:
In the Route Options drop-down, select Route and Record Non-Virtualized Request:
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.
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:
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:
– or –
In the connection string. The position where you enter user credentials depends on the database provider and the driver.
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.