Description

The H2InsertV2Receiver is used to insert a Domain's generated data directly into an H2 database table via a JDBC connection.


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 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.

   driver=<JDBCDriverClassName>
   user=<userToConnectToDatabase>
   password=<passwordToConnectToDatabase>
   url=<URL>/<databaseName>
   batchCount=1000


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. 
  • 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 (?,?,?)