All Products
Search
Document Center

Dataphin:Create an IBM DB2 data source

Last Updated:Jul 09, 2025

By creating an IBM DB2 data source, you can enable Dataphin to read business data from IBM DB2 or write data to IBM DB2. This topic describes how to create an IBM DB2 data source.

Background information

IBM DB2 is a relational database management system. If you use IBM DB2, you need to create an IBM DB2 data source before you can connect it to Dataphin for data development. For more information, see IBM DB2 official website.

Permissions

Only custom global roles with the Create Data Source permission and system roles such as Super Administrator, Data Source Administrator, Domain Architect, and Project Administrator can create data sources.

Procedure

  1. On the Dataphin homepage, choose Management Center > Datasource Management from the top navigation bar.

  2. On the Datasource page, click +Create Data Source.

  3. On the Create Data Source page, select IBM DB2 in the Relational Database section.

    If you have recently used IBM DB2, you can also select IBM DB2 in the Recently Used section. You can also enter keywords for IBM DB2 in the search box to quickly find it.

  4. On the Create IBM DB2 Data Source page, configure the parameters for connecting to the data source.

    1. Configure the basic information of the data source.

      Parameter

      Description

      Datasource Name

      The name must meet the following requirements:

      • The name can contain only Chinese characters, letters, digits, underscores (_), and hyphens (-).

      • The name cannot exceed 64 characters in length.

      Datasource Code

      After you configure the data source code, you can reference tables in the data source in a Flink_SQL task by using the data source code.table name or data source code.schema.table name format. If you need to automatically access the data source in the corresponding environment based on the current environment, use the variable format ${data source code}.table or ${data source code}.schema.table. For more information, see Dataphin data source table development method.

      Important
      • The data source code cannot be modified after it is configured successfully.

      • After the data source code is configured successfully, you can preview data on the object details page in the asset directory and asset inventory.

      • In Flink SQL, only MySQL, Hologres, MaxCompute, Oracle, StarRocks, Hive, and SelectDB data sources are currently supported.

      Data Source Description

      A brief description of the data source. The description cannot exceed 128 characters.

      Data Source Configuration

      Select the data source that you want to configure:

      • If your business data source distinguishes between production and development data sources, select Production + Development Data Source.

      • If your business data source does not distinguish between production and development data sources, select Production Data Source.

      Tag

      You can categorize and tag data sources based on tags. For information about how to create tags, see Manage data source tags.

    2. Configure the connection parameters between the data source and Dataphin.

      If you select Production + Development data source for your data source configuration, you need to configure the connection information for the Production + Development data source. If your data source configuration is Production data source, you only need to configure the connection information for the Production data source.

      Note

      In most cases, the production data source and development data source should be configured as different data sources to isolate the development environment from the production environment and reduce the impact of the development data source on the production data source. However, Dataphin also supports configuring them as the same data source with identical parameter values.

      For Configuration Method, you can select either JDBC URL or Host. The default selection is JDBC URL.

      JDBC URL configuration method

      Parameter

      Description

      JDBC URL

      The format of the connection address is jdbc:db2://host:port/dbname:currentSchema=schema;.

      Username, Password

      The username and password used to log on to the IBM DB2 database.

      Host configuration method
      • Host configuration method

        Parameter

        Description

        Server Address

        Enter the IP address and port number of the server.

        You can click +Add to add multiple sets of IP addresses and port numbers, and click the image icon to delete extra IP addresses and port numbers. You must keep at least one set.

        dbname

        Enter the database name.

        Schema

        Enter the schema information.

      • Parameter configuration

        Parameter

        Description

        Parameter

        • Parameter name: You can select an existing parameter name or enter a custom parameter name.

          Custom parameter names can only contain uppercase and lowercase letters, digits, periods (.), underscores (_), and hyphens (-).

        • Parameter value: When a parameter name is selected, the parameter value is required. It can only contain uppercase and lowercase letters, digits, periods (.), underscores (_), and hyphens (-), and cannot exceed 256 characters in length.

        Note

        You can click +Add Parameter to add multiple parameters, and click the image icon to delete extra parameters. You can add up to 30 parameters.

        Username, Password

        The username and password used to log on to the IBM DB2 database.

      Note

      When the configuration method is set to Host and the data source creation is complete, if you need to switch to the JDBC URL configuration method, the system will concatenate the server's IP address and port number into a JDBC URL for filling.

    3. Configure advanced settings for the data source.

      Parameter

      Description

      connectionTimeout

      The connectTimeout duration of the database (in seconds). The default value is 900 seconds (15 minutes).

      Note
      • If you have a connectTimeout configuration in the JDBC URL, the connectTimeout value is the timeout period configured in the JDBC URL.

      • For data sources created before Dataphin V3.11, the default connectTimeout value is -1, which indicates no timeout limit.

      Connection Retries

      If the database connection times out, the system will automatically retry the connection until the specified number of retries is reached. If the connection still fails after the maximum number of retries, the connection is considered failed.

      Note
      • The default number of retries is 1. You can configure a value between 0 and 10.

      • The connection retry count will be applied by default to offline integration tasks and global quality (requires the asset quality function module to be enabled). In offline integration tasks, you can configure task-level retry counts separately.

    Note

    Rules for duplicate parameters:

    • If a parameter exists in the JDBC URL, Advanced Settings parameters, and Host Configuration method's parameter configuration, the value in the JDBC URL takes precedence.

    • If a parameter exists in both the JDBC URL and Advanced Settings parameters, the value in the JDBC URL takes precedence.

    • If a parameter exists in both the Advanced Settings parameters and Host Configuration method's parameter configuration, the value in the Advanced Settings parameters takes precedence.

  5. Select a Default Resource Group. This resource group is used to run tasks related to the current data source, including database SQL, offline database migration, data preview, and more.

  6. Perform a Test Connection or directly click OK to save and complete the creation of the IBM DB2 data source.

    Click Test Connection, and the system will test whether the data source can connect to Dataphin normally. If you directly click OK, the system will automatically test the connection for all selected clusters. However, even if all selected clusters fail to connect, the data source can still be created normally.

    Test Connection tests the connection for the Default Cluster or Registered Scheduling Clusters that have been registered in Dataphin and are in normal use. The Default Cluster is selected by default and cannot be deselected. If there are no resource groups under a Registered Scheduling Cluster, connection testing is not supported. You need to create a resource group first before testing the connection.

    • The selected clusters are only used to test network connectivity with the current data source and are not used for running related tasks later.

    • The test connection usually takes less than 2 minutes. If it times out, you can click the image icon to view the specific reason and retry.

    • Regardless of whether the test result is Connection Failed, Connection Successful, or Succeeded With Warning, the system will record the generation time of the final result.

      Note

      Only the test results for the Default Cluster include three connection statuses: Succeeded With Warning, Connection Successful, and Connection Failed. The test results for Registered Scheduling Clusters in Dataphin only include two connection statuses: Connection Successful and Connection Failed.

    • When the test result is Connection Failed, you can click the image icon to view the specific failure reason.

    • When the test result is Succeeded With Warning, it means that the application cluster connection is successful but the scheduling cluster connection failed. The current data source cannot be used for data development and integration. You can click the image icon to view the log information.