Description
The MySQLCreateTableV2Receiver can be used to create a table in a MySQL database.
In This Article
- Receiver Parameters
- Column Data Types
- JDBC Configuration File
- Example JDBC Configuration File
- Receiver Attribute Property Keys
Receiver Parameters
The following parameters can be defined for the MySQLCreateTableV2Receiver. Items with an asterisk (*) are required.
- resourcePath* - Defines the directory of the resource that contains the database connection information on the user's local machine.
- resourceSubDir - Defines the sub-directory of the resource that contains the database connection information on the user's local machine.
- resourceName* - Defines the name of the resource that contains the database connection information on the user's local machine.
- databaseName* - The name of the database to create the SQL table in.
- tableName* - The name of the SQL table.
- engineType* - Specifies which MySQL database engine to use.
- primaryKeyName - Specifies the name of the attribute that is recognized as the table's primary key.
- autoIncrement* - Specifies if the primary key should be auto incremented.
- characterSet*- Specifies the character set to be used when creating the table.
- endOfLine* - The character(s) appended to the end of each line depending on the operating system.
- path - Defines the directory path where the output file should be stored.
- fileName - Name of the file the SQL create statement will be output to.
Column Data Types
This Receiver uses the following MySQL specific column data types:
- BIGINT
- BIGINT UNSIGNED
- BINARY
- BIT
- BLOB
- BOOL
- CHAR
- DATE
- DATETIME
- DECIMAL
- DOUBLE
- DOUBLE PRECISION
- ENUM
- FLOAT
- INT
- INT UNSIGNED
- LONG VARBINARY
- LONG VARCHAR
- LONGBLOB
- LONGTEXT
- MEDIUMBLOB
- MEDIUMINT
- MEDIUMINT UNSIGNED
- MEDIUMTEXT
- NUMERIC
- REAL
- SET
- SMALLINT
- SMALLING UNSIGNED
- TEXT
- TIME
- TIMESTAMP
- TINYBLOB
- TINYINT
- TINYINT UNSIGNED
- TINYTEXT
- VARBINARY
- VARCHAR
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:
driver=com.mysql.jdbc.Driver
user=root
password=openSaysMe
url=jdbc:mysql://localhost:3306/acme?rewriteBatchedStatements=true
Receiver Attribute Property Keys
The Receiver defines nine property keys that can be modified on any of its associated Domain Attributes:
- columnName - Specifies the column name as it will be created in the SQL statement.
- columnType - Specifies the type of column that will be created.
- columnSize - Specifies the size of the column.
- notNull - Specifies whether a column is or is not null.
- foreignTable - Name of the table to reference for the foreign key.
- foreignColumn - Name of column to reference in foreign table.
- onUpdate - InnoDB supports foreign key constraints for ON UPDATE.
- onDelete - InnoDB supports foreign key constraints for ON DELETE.
- unique - Specifies whether a column has a unique index.