Description
The H2InsertV2Receiver is used to insert a Domain's generated data directly into an H2 database table via a JDBC connection.
In This Article
Receiver Parameters
The following parameters can be defined for the H2InsertV2Receiver. Items with an asterisk (*) are required.
- resourcePath* - Defines the Directory path where the Resource is located.
- resourceSubDir - Defines an optional sub-directory under the resourcePath where the resource file exists.
- resourceName* - Defines the name of the resource that contains the database connection information on a user's local machine.
- tableName* - 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.
- booleanValue* - Format a Boolean object with the selected mask.
- rowDelimiter* - Defines the bytes that delimit each row.
- nullValue* - Represents a Null value.
- quoteTextData* - Defines the character to use when quoting text data.
- sharedConnection - Determines whether to share the connection between different instances of this Receiver. The sharedConnection must be false when generating the data using the Partition Engine.
Column Data Types
This Receiver uses the following column data types:
- VARCHAR
- BOOLEAN
- DECIMAL
- DATE
- CHAR
- VARCHAR_IGNORECASE
- INT
- IDENTITY
- BIGINT
- DOUBLE
- TIME
- TIMESTAMP
JDBC Configuration File
This Receiver utilizes a configuration file stored locally on the user's computer or a shared test server to obtain the necessary information to connect to a specific database via JDBC. For detailed information, refer to 'What is a JDBC Config File?'
Receiver Attribute Property Keys
The Receiver defines four property keys that can be modified on any of its associated Domain Attributes:
- columnName - Defines the name of the column as it is in the actual database table (e.g., first_name, last_name, billing_street, shipping_state).
- dataType - Defines the column data type.
- include - Defines if the column should be included or excluded from the insert statement.
- escapeColumn - If true, the column name gets enclosed by double quotes when the Receiver creates a prepared insert statement. If false, the column name is not enclosed in double quotes.
Escape Column Example
A Users table contains an id, username, and password column. When escapeColumn is set to false for all Attributes, the Prepared Statement would appear as below:
insert into table Users (id. username, password) values (?,?,?)
When escapeColumn is set to true for the username Attribute, the Prepared Statement will appear as shown below:
insert into table Users (id, "username", password) values (?,?,?)