Configure the IBM DB2 input component

Updated at:

The IBM DB2 input component reads data from an IBM DB2 data source. To synchronize data from an IBM DB2 data source to a target, you first configure the IBM DB2 input component and then the target data source. This topic describes how to configure the IBM DB2 input component.

Prerequisites

Ensure you have completed the following prerequisites:

Procedure

  1. On the Dataphin homepage, choose Development > Data integration from the top navigation bar.

  2. In the top navigation bar of the page, select a project. If you are using the Dev-Prod mode, you must also select an environment.

  3. In the left-side navigation pane, click Batch integration. In the Batch integration list, click the desired batch pipeline to open its configuration page.

  4. In the upper-right corner of the page, click Component library to open the Component library panel.

  5. In the left-side navigation pane of the Component library panel, select Input. Find the IBM DB2 component in the list of input components on the right and drag it onto the canvas.

  6. On the IBM DB2 input component card, click the image icon to open the IBM DB2 input configuration dialog box.

  7. In the IBM DB2 input configuration dialog box, configure the parameters.

    Parameter

    Description

    Step name

    The name of the IBM DB2 input component. Dataphin automatically generates a step name, which you can customize. The name must meet the following requirements:

    • Can contain only Chinese characters, letters, underscores (_), and digits.

    • Cannot exceed 64 characters in length.

    Data source

    From the drop-down list, select the data source. The list displays all IBM DB2 data sources in Dataphin, including those for which you have or do not have the read permission for data synchronization. You can click the image icon to copy the name of the current data source.

    For a data source for which you do not have the read permission for data synchronization, you can click Apply next to the data source to request the permission. For more information, see Apply for, renew, and revoke data source permissions.

    If you do not have an IBM DB2 data source, click New data source to create one. For more information, see Create an IBM DB2 data source.

    Table

    Enter keywords to search for a table, or enter the exact table name and then click Exact search. After you select a table, the system automatically checks its status. Click the image icon to copy the name of the selected table.

    Split key (Optional)

    The system shards data based on the configured split key field, which you can use with concurrency to enable parallel reads. You can use any column from the source table as the split key. For best performance, use a primary key or an indexed column.

    Important

    If you select a date and time type, the system identifies the maximum and minimum values and performs a brute-force split based on the total time range and concurrency. Even distribution is not guaranteed.

    Batch size for reading (Optional)

    Setting a batch size for reading (for example, 1024) reduces round trips to the data source by reading multiple records at once. This improves I/O efficiency and lowers network latency.

    Filter (Optional)

    Define a filter to extract specific data:

    • Use a fixed value to extract matching data, such as ds=20210101.

    • Use a variable to extract a subset of data, such as ds=${bizdate}.

    Output fields

    The output fields section shows all fields that match the selected table and filter conditions. You can perform the following operations:

    • Field management: To prevent fields from being sent to downstream components, remove them:

      • Delete a single field: To remove a single field, click the sgaga icon next to it in the Actions column.

      • Delete fields in bulk: To remove multiple fields in bulk, click Field management. In the Field management dialog box, select the fields, click the image icon to move them to the unselected list, and then click OK.

        image..png

    • Batch add: Click Batch add to configure fields in bulk by using the JSON, TEXT, or DDL format.

      Note

      After you batch add fields and click OK, this action overwrites the existing field configuration.

      • To configure fields in bulk by using the JSON format, see the following example:

        // Example:
          [{
             "index": 1,
             "name": "id",
             "type": "int(10)",
             "mapType": "Long",
             "comment": "comment1"
           },
           {
             "index": 2,
             "name": "user_name",
             "type": "varchar(255)",
             "mapType": "String",
             "comment": "comment2"
         }]
        Note

        The parameters define the properties of imported fields: index is the 1-based column number, name is the field name, and type is the field type. For example, "index":3,"name":"user_id","type":"String" imports the third column as a String-type field named user_id.

      • To configure fields in bulk by using the TEXT format, see the following example:

        // Example:
        1,id,int(10),Long,comment1
        2,user_name,varchar(255),Long,comment2
        • The row delimiter separates the information for each field. The default is a newline character (\n). Semicolons (;) and periods (.) are also supported.

        • The column delimiter is used to separate field names and field types. The default is a half-width comma (,), and the',' character is supported. You can omit the field type, and the default is ','.

      • To configure fields in bulk by using the DDL format, see the following example:

        CREATE TABLE tablename (
        	user_id serial,
        	username VARCHAR(50),
        	password VARCHAR(50),
        	email VARCHAR (255),
        	created_on TIMESTAMP,
        );
    • New output field: Click +New output field, enter the Field name, Type, and Comment, and select a Mapped type. After configuring the row, click the image icon to save it.

      System field: Select a system field to identify the source of each row. This is useful when synchronizing data from multiple tables (for example, sharded databases and tables) into the same target table. The system automatically populates the field type and mapped type for system fields. System fields include:

      • dp_datasource: The name of the synchronized data source.

      • dp_dbname: The name of the synchronized database, if any.

      • dp_schema: The name of the synchronized schema, if any.

      • dp_source_table: The name of the synchronized source table.

      • dp_read_timestamp: The start time of the source SELECT statement.

      You can concatenate multiple system variables, for example, dp_dbname.dp_source_table.

      Note
      • You cannot modify the field type or mapped type of a system field.

      • The dp_read_timestamp field supports only standalone configuration and cannot be concatenated.

  8. Click Confirm to save the component's configuration.