IBM Db2
The IBM Db2 origin reads data from an IBM Db2 database. For information about supported versions, see Supported Systems and Versions in the Data Collector documentation.
The IBM Db2 origin can use multiple threads to process tables in parallel.
When you configure the IBM Db2 origin, you specify the database name, host name, and port number. In addition, you can enable the origin to use SSL. You can also use a connection to configure the origin.
The origin generates record header attributes that enable you to use the origins of a record in pipeline processing.
Before you use the IBM Db2 origin, you must complete some prerequisite tasks.
Prerequisites
Before you configure the IBM Db2 origin, complete the following prerequisite tasks.
Multithreaded processing
The IBM Db2 origin uses multiple concurrent threads to process data based on the Number of Threads property. Each table is processed by only one thread a time, which ensures that the order of batches and records from each table is preserved.
As the pipeline runs, each thread connects to the origin system, creates a batch of data, and passes the batch to an available pipeline runner. A pipeline runner is a sourceless pipeline instance - an instance of the pipeline that includes all of the processors, executors, and destinations in the pipeline and handles all pipeline processing after the origin.
Each pipeline runner processes one batch at a time, just like a pipeline that runs on a single thread. When the flow of data slows, the pipeline runners wait idly until they are needed, generating an empty batch at regular intervals. You can configure the Runner Idle Time pipeline property to specify the interval or to opt out of empty batch generation.
Multithreaded pipelines preserve the order of records within each batch, just like a single-threaded pipeline. But since batches are processed by different pipeline runners, the order that batches are written to destinations is not ensured.
For more information about multithreaded pipelines, see Multithreaded pipeline overview.
Record header attributes
The IBM Db2 origin creates record header attributes that include information about the originating file for the record.
You can use the record:attribute or
record:attributeOrDefault functions to access the information
in the attributes. For more information about working with record header attributes,
see Working with header attributes.
- schemaName - Name of the schema containing the table the record comes from.
- tableName - Name of the table the record comes from.
Field attributes
The IBM Db2 origin generates field attributes for columns converted certain data types in Data Collector. The attributes provide additional information about each field.
| Data Collector Data Type | Generated Field Attribute | Description |
|---|---|---|
| Date | unit | Original unit in which the date was obtained from IBM Db2. |
| Datetime | unit | Original unit in which the date was obtained from IBM Db2. |
| Decimal | precision | Precision of the value obtained from IBM Db2. |
| Decimal | bit_width | Original bit width in which the value was obtained from IBM Db2. |
| Decimal | scale | Scale of the value obtained from IBM Db2. |
| Decimal and String | flight_type | Original flight type. |
| Double and Float | precision | Original precision obtained from IBM Db2. |
| Integer, Long, and Short | bit_width | Original bit width in which the value was obtained from IBM Db2. |
| Integer, Long, and Short | signed | Whether the original value obtained from IBM Db2 was signed. |
| Time | unit | Original unit in which the date was obtained from IBM Db2. |
IBM Db2 data types
The IBM Db2 origin converts IBM Db2 data types into Data Collector data types before passing them to the pipeline.
| IBM Db2 Data Type | Data Collector Data Type |
|---|---|
| BigInt | Long |
| Binary | Byte Array |
| Binary_View | Byte Array |
| Boolean | Boolean |
| Char | String |
| Clob | String |
| Date | Date |
| Dbclob | String |
| DecFloat | String |
| Decimal | Decimal |
| Double | Double |
| Duration | Long |
| Fixed_Size_Binary | Byte Array |
| Fixed_Size_List | List |
| Graphic | String |
| Integer | Integer |
| Large_Binary | Byte Array |
| Large_List | List |
| Large_List_View | List |
| List | List |
| List_View | List |
| Nchar | String |
| Numeric | Decimal |
| Nvarchar | String |
| Real | Float |
| SmallInt | Short |
| Struct | Map |
| Time | Time |
| Timestamp | Datetime |
| Varchar | String |
| Vargraphic | String |
| XML | String |
Key column data types
The origin supports the following Data Collector data types as key columns:
- Boolean
- Char
- Date
- Datetime
- Decimal
- Double
- Float
- Integer
- Long
- Short
- String
- Time
- Zoned Datetime
Troubleshooting IBM Connectivity Service
The origin
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 origin
Configure an IBM Db2 origin to read data from an IBM Db2 database.