Description
A JDBC configuration file contains a standard set of parameters that enables a source (i.e., GenRocket Runtime) to connect to a target database. GenRocket can connect to any database that supports JDBC. This file is also referred to as the config.properties file and it should contain these parameters:
- driver - Defines the path and name of the JDBC driver Jar file. The Jar contains a Java program that uses the JDBC API to load the specified driver for a particular DBMS before it actually connects to a database. The JDBC DriverManager class then sends all JDBC API calls to the loaded driver. Note: Varies per database.
- user - Defines a name used to connect as a user to the database.
- password - Defines a password used to connect to the database for the given user.
- url - Defines the Universal Resource Locator (URL) to connect to the database. Note: Varies per database.
- batchCount - Defines the number of rows sent to the database per batch. This property is only mandatory for GenRocket Receivers.
NOTE: You can also encrypt this file for increased security. See How do I Encrypt Config and Property Files? to learn more.
Example JDBC Configuration File
Below is an example of a JDBC configuration file defined to connect to a MySQL database called acme:
driver=com.mysql.jdbc.Driver user=root password=openSaysMe url=jdbc:mysql://localhost:3306/acme?rewriteBatchedStatements=true batchCount=1000
You can find additional examples in the appropriate connection article:
What Features Require this File?
This file must be present for Runtime to connect to the database and query, insert, mask, or migrate a subset of data via JDBC. The following features require this file:
- Certain Generators
- e.g., QueryBeforeLoopV2Gen, QueryEachLoopV2Gen, QueryToMapGen
- Certain Receivers
- e.g., GenericSQLInsertV2Receiver, SQLUpdateReceiver, StoredProcedureCallReceiver
- XTS (Extract Table Schema)
- G-Queries
- G-Migration+
- G-Delta
How Does GenRocket Know Where this File is Stored?
When you use a JDBC Config file to connect to a database and perform an action (query, insert, mask, subset, etc.), three important parameters define the location of the file:
- resourcePath- path to the JDBC config file (typically the resource.jdbc.directory)
- See Organization Resourcesto learn more.
- resourceSubDir - subdirectory where the file is stored in the defined path.
- resourceName- the name of the JDBC config file (default name is config.properties, but can be different)
See How do I Structure Resource Subdirectories to Store Config Files? to learn more about how to structure and store config files.
Generator Example
Receiver Example