Description

The following command-line options instruct GenRocket to test a JDBC connection for SQL databases. They cannot be used to test a JDBC connection for a NoSQL database. 


Some GenRocket Generators, Receivers, and features have the capability to connect to databases via JDBC (e.g., GenericSQLInsertReceiver). Receivers that access databases via JDBC must read from a properties file on a local computer to attain the necessary information to connect to a database. 


These two command line options are most commonly used for debugging purposes and to ensure that GenRocket can connect to the database using the information provided by the JDBC Config File


Commands 

-tjdbc
--test-jdbc <propertiesFile>


Required Parameters

  • <propertiesFile> - the location and name of the JDBC configuration file.


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
batchCount=1000


Example Testing Unencrypted Properties File


Example Testing Encrypted File


Exception - Connection Failed

A GenRocket exception will be thrown if the connection does not succeed. 


Example 1 - If the name of the database cannot be found because it was spelled 'acme10' instead of 'acme,' the following GenRocket exception would be thrown: 

  • Exception in thread "main" com.genRocket.GenRocketException: Unkown database 'acme10'


Example 2 - If the path or name of the JDBC Config file is wrong, the following GenRocket exception will be thrown: 

  • Exception in thread "main" com.genRocket.GenRocketException: File not found: <pathToFile>


Example 3 - If the password in the file is incorrect, the following GenRocket exception will be thrown: 

  • Exception in thread "main" com.genRocket.GenRocketException: Access denied for user 'username'@'localhost' (using password: YES)