All Products
Search
Document Center

Dataphin:Create a TiDB data source

Last Updated:May 28, 2025

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

Permission requirements

Only users who have the Create Data Source permission point in a custom global role and users who have the super administrator, data source administrator, domain architect, or project administrator system role can create data sources.

Procedure

  1. On the Dataphin homepage, click Management Hub > Datasource Management in the top navigation bar.

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

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

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

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

    1. Configure the basic information of the data source.

      Parameter

      Description

      Data Source Name

      The name must meet the following requirements:

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

      • It cannot exceed 64 characters in length.

      Datasource Code

      After you configure the data source code, you can reference tables in the data source in Flink_SQL tasks 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.

      Version

      Only TiDB v4, TiDB v5, and TiDB v6 versions are supported.

      Data Source Description

      The description of the TiDB data source. It cannot exceed 128 characters in length.

      Real-time Development

      After this option is enabled, the data source can be used for real-time development, but you need to fill in the real-time development configuration items.

      Data Source Configuration

      Based on whether the business data source distinguishes between production data sources and development data sources:

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

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

      Tag

      You can categorize data sources by using 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

      Typically, production data sources and development data sources should be configured as different data sources to achieve environment isolation between development data sources and production data sources, reducing the impact of development data sources on production data sources. However, Dataphin also supports configuring them as the same data source, meaning with identical parameter values.

      Parameter

      Description

      JDBC URL

      The format of the connection URL is: jdbc:mysql://host:port/dbname. For example: jdbc:mysql//192.168.*.212.4000/dataphin.

      Username, Password

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

      pd-addresses

      After enabling real-time development, you need to enter the pd-addresses information of the database TIKV cluster.

    3. Configure advanced settings for the data source.

      Parameter

      Description

      connectTimeout

      The connectTimeout duration of the database (unit: milliseconds), default is 900000 milliseconds (15 minutes).

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

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

      socketTimeout

      The socketTimeout duration of the database (unit: milliseconds), default is 1800000 milliseconds (30 minutes).

      Note
      • If you have a socketTimeout configuration in the JDBC URL, the socketTimeout will be the timeout period configured in the JDBC URL.

      • For data sources created before Dataphin V3.11, the default socketTimeout is -1, indicating no timeout limit.

      Connection Retries

      If the database connection times out, the system will automatically retry the connection until the set number of retries is completed. If the maximum number of retries is reached and the connection is still unsuccessful, the connection fails.

      Note
      • The default number of retries is 1, and 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.

  5. Select a Default Resource Group, which 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 TiDB data source.

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