The GenericSQLInsertV2Receiver is used to insert a Domain's generated data directly into a database table via a JDBC connection.
The following parameters can be defined for the GenericSQLInsertV2Receiver. Items with an asterisk (*) are required.
- resourcePath* - Defines the Directory path where the Resource file is located.
- resourceSubDir - Defines an optional subdirectory under the resourcePath that where the Resource file exists.
- resourceName* - Defines the name of the resource that contains the database connection information on a user's local machine.
- databaseName* - Defines the name of the database to access.
- tableName - Defines the name of the database table to insert rows into.
- uniqueAttribute - Defines a Domain Attribute the Receiver will use to identify a unique value that has already been inserted into the table to prevent duplicate data entry where a unique constraint is required.
- truncate - Truncates the table before inserting rows by executing a 'delete from table' statement.
- statementSeparator - Defines when a SQL statement has ended.
- booleanValue - Format a Boolean object with the selected mask.
- rowDelimiter - Defines the bytes that delimit each row.
- nullValue - Represents Null value.
- quoteTextData - Defines the character to use when quoting text data.
- generatedKeysFilePath - Defines the path where the file having generated keys will be stored.
- generatedKeysFileName - Defines the file name in which generated keys will be stored.
- escapeCharForIndentifiers - Escape character is used to wrap identifiers: schema name, table name, and column name. The parameter is useful when identifiers contain special characters like ?, ', ", etc.
Escape Character Cases
Parameter Value: '
Example: 'db name'.'table name'.'column name'
Parameter Value: 
Example: [db name].[table name].[column name]
Parameter Value: #$#
Example: #$db nam#'.#$table name#.#$column name#
Note: Escape character for identifiers depends on database configuration. Please check with your DBA to find out the appropriate escape character for your database, if required.
Column Data Types
This Receiver uses a set of standard data types to populate columns within most database tables; these column data types should successfully work with most databases that allow for data insertion via JDBC.
The column data types are the following:
- String - gets translated to a VARCHAR
- Boolean - native data type
- BigDecimal - gets translated to a DECIMAL
- Date - native data type
- Double - native data type
- Float - native data type
- Integer - native data type
- Long - gets translated to a BIGINT
- Time - native data type
- Timestamp - native data type
- Varbinary - gets translated to Bytes
JDBC Configuration File
This Receiver uses a configuration file, located on the user's local computer, as a resource to attain the necessary information for connecting to a user's local database via JDBC. The required properties to connect to a database via JDBC are the following:
- driver - The path and file name of the JDBC library for the database to connect to.
- user - The name used to connect as a user to the database.
- password - The password used to connect as the given user to the database.
- url - The JDBC universal resource locator required to connect to the given database.
- batchCount - Defines the number of rows of generated data that are batched together before writing to the database.
Example JDBC Configuration File
Below is an example of a JDBC configuration file defined to connect to a MySQL database called, acme:
Receiver Attribute Property Keys
The Receiver defines three property keys that can be modified on any of its associated Domain Attributes:
The example image below shows the property key view for the set of Attributes of a Domain using the GenericSQLInsertV2Receiver.