DB2DataWriter loads data into DB2 database.
|Component||Data output||Input ports||Output ports||Transformation||Transf. required||Java||CTL||Auto-propagated metadata|
DB2DataWriter does not propagate metadata.
Error Metadata cannot use Autofilling Functions.
Table 56.2. Error Metadata for DB2DataWriter
|Field number||Field name||Data type||Description|
|0||<any_name1>||integer||The incorrect record's number (records are numbered starting from 1).|
The incorrect field's number (for delimited records), fields are numbered starting from 1 | offset of an incorrect field (for fixed-length records).
Metadata of an external file.
The metadata must be delimited.
Each column, except the last one, is followed by an identical, one char delimiter.
The last delimiter following the last column is
|Database||yes||The name of the database into which records should be loaded.|
|Database table||yes||The name of the database table into which records should be loaded.|
|User name||yes||Database user.|
|Password||yes||Password for database user.|
Mode of the action performed when loading data.
For more information, see Load mode.
|insert (default) | replace | restart | terminate|
Sequence of individual mappings (
The sequence of Clover fields separated by a semicolon, colon, or pipe. For more information, see Mapping of Clover Fields to DB Fields.
The sequence of DB fields separated by a semicolon, colon, or pipe. For more information, see Mapping of Clover Fields to DB Fields.
|Loader input file|||
Name of input file to be loaded, including path. For more information, see Loader input file.
All parameters that can be used as parameters by the
|Rejected records URL (on server)|
The name of the file, including the path, on a DB2 server where rejected records will be saved. Must be located in the directory owned by the database user.
|Batch file URL|
The URL of the file where the
It is reasonable to use this attribute in connection with the Loader input file attribute, because the batch file contains the name of temporary data file which is generated at random, if not provided explicitly.
The path must not contain white spaces.
|DB2 command interpreter|
Interpreter that should execute script with DB2 commands
|Use pipe transfer|
By default, data from an input port is written to a temporary file and then it is read by the component.
If set to
|false (default) | true|
The first one char field delimiter from File metadata
or the metadata on the input edge (if File metadata is not specified).
A character used as a delimiter for each column in data file.
The delimiter must not be contained as a part of a field value.
The same delimiter can be set by specifying the value of the
|Number of skipped records|
The number of records to be skipped. By default, no records are skipped. This attribute is applied only if data is received through the input port; otherwise, it is ignored.
|0 (default) | 1-N|
|Max number of records|
The maximum number of records to be loaded into database.
The same can be set by specifying the value of the
|all (default) | 0-N|
|Max error count|
The Maximum number of records after which the load stops.
If the number is set explicitly and when it is reached,
the process can continue in RESTART mode.
In REPLACE mode, the process continues from the beginning.
The same number can be specified with the help of
|all (default) | 0-N|
|Max warning count||The maximum number of printed error messages and/or warnings.||999 (default) | 0-N|
|Fail on warnings|
By default, the component fails on errors.
By switching the attribute to
|false (default) | true|
DB2DataWriter loads data into a database using a DB2 database client. It can read data through the input port or from an input file. If the input port is not connected to any other component, data must be contained in an input file that should be specified in the component. If you connect some other component to the optional output port, it can serve to log the information about errors. The DB2 database client must be installed and configured on localhost. The server and database must be cataloged as well.
Mapping of Clover Fields to DB Fields
Field Mapping is Defined
If a Field mapping is defined, the value of each Clover field specified in this attribute is inserted to such DB field to whose name this Clover field is assigned in the Field mapping attribute.
Both Clover Fields and DB Fields are Defined
If both Clover fields and DB fields are defined (but Field mapping is not), the value of each Clover field specified in the Clover fields attribute is inserted to such DB field which lies on the same position in the DB fields attribute.
The number of Clover fields and DB fields in both of these attributes must equal to each other. The number of either part must equal to the number of DB fields that are not defined in any other way (by specifying Clover fields prefixed by dollar sign, db functions or constants in the query).
Pattern of Clover fields:
Pattern of DB fields:
Only Clover Fields are Defined
If only the Clover fields attribute is defined (but Field mapping and/or DB fields are not), the value of each Clover field specified in the Clover fields attribute is inserted to such DB field whose position in DB table is equal.
Number of Clover fields specified in the Clover fields attribute must equal to the number of DB fields in DB table that are not defined in any other way (by specifying Clover fields prefixed by a dollar sign, db functions, or constants in the query).
Pattern of Clover fields:
Mapping is Performed Automatically
If neither Field mapping, Clover fields, nor DB fields are defined, the whole mapping is performed automatically. The value of each Clover field of Metadata is inserted into the same position in the DB table.
The number of all Clover fields must equal to the number of DB fields in the DB table that are not defined in any other way (by specifying Clover fields prefixed by a dollar sign, db functions, or constants in the query).
Loaded data is added to the database table without deleting or changing existing table content.
All data existing in the database table is deleted and new loaded data is inserted to the table. Neither the table definition nor the index definition are changed.
Previously interrupted load operation is restarted. The load operation automatically continues from the last consistency point in the load, build, or delete phase.
Previously interrupted load operation is terminated and rolled back to the moment when it started even if consistency points had been passed.
Loader input file
Loader input file is the name of the input file
with data to be loaded, including its path.
Normally, this file is a temporary storage for data to be passed to dbload utility unless
named pipe is used instead.
Remember that a DB2 client must be installed and configured on localhost (see IBM data server clients and drivers overview and Installing IBM data server clients (Linux and UNIX)). The server and database must be cataloged as well.
If it is not set, a loader file is created in CloverDX or OS temporary directory (on Windows) or
named pipeis used instead of a temporary file (on Unix). The file is deleted after the load finishes.
If it is set, a specified file is created. It is not deleted after data is loaded and it is overwritten on each graph run.
If the input port is not connected, the file must exist, must be specified and must contain data that should be loaded into the database. It is not deleted nor overwritten.
Notes and Limitations
DB2DataWriter cannot write maps and fields.