Create a TiDB data source to enable Dataphin to read business data from or write data to TiDB.
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
-
On the Dataphin homepage, click Management Hub > Datasource Management in the top navigation bar.
-
On the Datasource page, click +Create Data Source.
-
On the Create Data Source page, select TiDB in the Relational Database section.
If you recently used TiDB, you can also find it in the Recently Used section or search for it by keyword.
-
On the Create TiDB Data Source page, configure the parameters for connecting to the data source.
-
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 nameordata source code.schema.table nameformat. 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}.tableor${data source code}.schema.table. For more information, see Dataphin data source table development method.ImportantThe data source code cannot be modified after it is configured.
You can preview data on the object details page in the asset directory and asset checklist only after the data source code is configured.
In Flink SQL, only MySQL, Hologres, MaxCompute, Oracle, StarRocks, Hive, SelectDB, and GaussDB data warehouse service (DWS) data sources are currently supported.
Version
Only TiDB v4, TiDB v5, and TiDB v6 versions are supported.
Data Source Description
Description of the data source. Maximum length: 128 characters.
Real-time Development
Enable this option to use the data source for real-time development. You must complete the real-time development configuration.
Data Source Configuration
Choose based on whether your business data source separates production and development environments:
-
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.
-
-
Configure the connection parameters between the data source and Dataphin.
If you selected Production + Development data source, configure the connection information for both environments. If you selected Production data source, configure only the production connection information.
NoteWe recommend configuring separate data sources for production and development to achieve environment isolation. However, Dataphin also supports using the same data source with identical parameter values for both environments.
Parameter
Description
JDBC URL
Connection URL format:
jdbc:mysql://host:port/dbname. Example:jdbc:mysql//192.168.*.212.4000/dataphin.Username, Password
The username and password used to log in to the database.
pd-addresses
Required when real-time development is enabled. Enter the pd-addresses of the TiKV cluster.
-
Configure advanced settings for the data source.
Parameter
Description
connectTimeout
Database connection timeout in milliseconds. Default: 900000 (15 minutes).
Note-
If connectTimeout is configured in the JDBC URL, that value takes precedence.
-
For data sources created before Dataphin V3.11, the default connectTimeout is
-1, indicating no timeout limit.
socketTimeout
Database socket timeout in milliseconds. Default: 1800000 (30 minutes).
Note-
If socketTimeout is configured in the JDBC URL, that value takes precedence.
-
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 automatically retries until the configured retry limit is reached.
Note-
The default number of retries is 1, and you can configure a value between 0 and 10.
-
Connection retries apply by default to offline integration tasks and global quality (requires the asset quality module). You can configure task-level retry counts separately in offline integration tasks.
-
-
-
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.
-
Perform a Test Connection or directly click OK to save and complete the creation of the TiDB data source.
Click Test Connection to verify connectivity with Dataphin. If you click OK directly, the system tests all selected clusters automatically, but the data source is created even if all selected clusters fail to connect.