GenRocket Runtime must be connected to a database before a query or data insertion can be performed during test data generation.

In This Article

Two Reasons to Connect to a Database

There are two primary reasons for making a connection to a database (e.g., MySQL, MS SQL, Oracle) with GenRocket:

  1. Retrieve Data from a Database (Query Data) 
    • Data is retrieved from the database during test data generation using GenRocket Runtime. 
    • This is done using Generators (e.g., ListQueryGen, QueryBeforeLoopGen, etc.) or through the Self Service Platform using G-Queries.
  2. Populate Database Tables (Insert Data)
    • Populate tables with test data generated using GenRocket Runtime.
    • This is done using Receivers like GenericSQLInsertReceiver, MySQLInsertReceiver, etc.

To use these Generators and Receivers, GenRocket leverages JDBC.

What is JDBC?

JDBC stands for Java™ database connectivity (JDBC) and is the JavaSoft specification of a standard application programming interface (API) that allows Java programs to access database management systems. GenRocket can connect to any database that supports JDBC. 

Database Connection Steps

Step 1 - Create a JDBC Configuration Properties File

A file is needed for GenRocket to connect to a database via JDBC. GenRocket can connect a database via JDBC by reading a JDBC properties file that contains the following information. 

  • driver - Defines the name of the specific database driver to use to access the given database. The actual driver file must be placed in the $GEN_ROCKET_HOME/lib folder on your local computer.
  • user - Defines the Username used to access the database.
  • password - Defines the password used to access the database.
  • url - Defines the specific URL to access the database.
  • batchCount - Defines the number of SQL statements that are batched together and sent to the database for execution. This property is only mandatory for GenRocket Receivers.


Example for MySQL database

GenRocket will read this config file and connect to the employee database on localhost using username root and password root.  


Note: If you are connecting to a different type of database, your configuration file will look different.

Note: It is possible to have more than one file for different database connections. This requires a little planning and organization, which is further explained here.

Step 2 - Enter a Value for Resource

An Organization Resource titled will be automatically available within the GenRocket web platform. It is used to define the primary directory of the file(s) so that the database connection can be made when querying or inserting data. 

The path will vary depending on the operating system and is typically located within the user's home directory. 

  • Windows Example Path - C:\Users\Username\databases 
  • Mac OSX Example Path - /home/Users/Username/databases

Note: If more than one file is being used and has been organized into resource subdirectories, the actual subdirectory can be defined within the Receiver configuration within a selected Project Version of a given Project.

This is done via the Organization Resources Pane within the Project Dashboard by using the Edit (Pencil) icon. The resource value is configured per user and should be set to  To see step-by-step instructions for changing a resource value, click here

Example Configuration

  • Set the value of the resource variable to the config file name with the full file path of the directory/folder that contains the file.

  • For example, say you have added at location /home/user/Desktop/. Then the resource value will be /home/user/Desktop.

In the example below, the file is stored on a Windows machine within a subdirectory titled 'databases': C:\Users\april\databases.

Important: After adding the new resource with its value, you will need to update your Profile (in ~/.genrocket folder) on your system. GenRocket will read this resource value from your profile on your system to make a connection with the database. 

Step 3 - Download and Place the JDBC connector Jar file into the $GENROCKET_HOME/lib/ folder

  • Download and place the appropriate JDBC connector Jar file in your genrocket-3.5.6/lib folder.
  • Links are provided below for the following: MySQL, Oracle, and MS SQL.

Note: It is OK if your version doesn't match the one above -- still, just place the MySQL connector in the lib directory.




Microsoft provides the JDBC driver for free. You can download the one that works for your version of SQL Server from one of these links: 

For information about system requirements and detailed information about each of the drivers listed above, please go to

Step 4 - Reference the JDBC Resource in your Generators or Receivers

When you create a Scenario that has a Generator or Receiver that references your jdbc.config resource, it will connect directly to your database.