IBM Db2
The IBM Db2 destination writes data to an IBM Db2 database. For information about supported versions, see Supported Systems and Versions in the Data Collector documentation.
When you configure the IBM Db2 destination, you specify the database name, host name, and port number. In addition, you can enable the destination to use SSL. You can also use a connection to configure the destination.
You specify tables to load the data into and the write mode the destination uses to write data from record fields to table columns.
Before you use the IBM Db2 destination, you must complete some prerequisite tasks.
Prerequisites
Before you configure the IBM Db2 destination, complete the following prerequisite tasks.
Specifying tables
You can use the IBM Db2 destination to write to one or more tables.
- Single table
- To write data to a single table, simply enter the table name and schema name for the table.
- Multiple tables in a single schema
- To write data to multiple tables in a single schema, specify a field or header in the record that defines the table names as follows.
- Multiple tables in multiple schemas
- To write data to multiple tables in multiple schemas, specify fields or headers in the record that define the table and schema names as follows.
Use the Table Name and Schema Name properties on the Table tab to specify the tables to write to.
Key columns
When using merge or update write mode, you specify which set of key columns to use to compare records with rows in the database.
- Use the table primary keys
- The stage uses the table primary keys to configure the operations. Use this option when primary key columns are defined for the table.
- Use columns specified in the headers
- The stage uses key columns stored in the indicated record header attribute for the first record in a batch. Key columns must be listed as a JSON-formatted list or a comma-separated list. If the record header attribute is empty, the stage uses the table's primary keys.
- Use specified columns for each table
- Specify a set of key columns for each table. If the key columns property for a table is left empty, the stage uses the table's primary keys.
IBM Db2 data types
The IBM Db2 destination converts Data Collector data types into IBM Db2 data types before loading data into the database.
| Data Collector Data Type | IBM Db2 Data Type |
|---|---|
| Boolean | SmallInt |
| Byte | SmallInt |
| Byte_Array | Binary, Binary_View, Fixed_Size_Binary, or Large_Binary depending on the original data type stored in metadata |
| Char | Vargraphic |
| Date | Date |
| Datetime | Timestamp |
| Decimal | Decimal |
| Double | Double |
| Float | Real |
| Integer | Integer |
| List | List, Large_List, Fixed_Size_List, List_View, or Large_List_View depending on the original data type stored in metadata |
| Long | BigInt |
| Map | Map or Struct depending on the original data type stored in metadata |
| Short | SmallInt |
| String | Vargraphic |
| Time | Time |
| Zoned_Datetime | Timestamp |
Troubleshooting IBM Connectivity Service
The destination
connects to the database through IBM Connectivity Service. IBM Connectivity Service and all stages that use the service are bundled into
the IBM Connectivity Service stage library,
streamsets-datacollector-ibm-connectivity-service-lib. By default, Data Collector runs IBM Connectivity Service when the IBM
Connectivity Service stage library is installed.
| Call | CURL request |
|---|---|
| Get IBM Connectivity Service state |
curl -X GET <HOST PREFIX>/tunneling/rest/<ENGINE ID>/rest/v1/flight/state -H "Content-Type:application/json" -H "X-Requested-By:curl" -H "X-SS-REST-CALL:true" -H "X-SS-App-Component-Id: <CRED_ID>" -H "X-SS-App-Auth-Token: <CRED_TOKEN>." -i |
| Restart IBM Connectivity Service |
curl -X GET <HOST PREFIX>/tunneling/rest/<ENGINE ID>/rest/v1/flight/restart -H "Content-Type:application/json" -H "X-Requested-By:curl" -H "X-SS-REST-CALL:true" -H "X-SS-App-Component-Id: <CRED_ID>" -H "X-SS-App-Auth-Token: <CRED_TOKEN>" -i |
| Get IBM Connectivity Service logs |
curl -X GET <HOST PREFIX>/tunneling/rest/<ENGINE ID>/rest/v1/flight/logs -H "Content-Type:application/json" -H "X-Requested-By:curl" -H "X-SS-REST-CALL:true" -H "X-SS-App-Component-Id: <CRED_ID>" -H "X-SS-App-Auth-Token: <CRED_TOKEN>" -i |
Configuring an IBM Db2 destination
Configure an IBM Db2 destination to write data to an IBM Db2 database.