Create a PolarDB-X 2.0 data source so that Dataphin can read business data from or write data to PolarDB-X 2.0.
Permissions
Only users with a custom global role that includes the Create Data Source permission, or users with the system roles of super administrator, data source administrator, board architect, and project administrator can create data sources.
Procedure
In the top menu bar of the Dataphin home page, choose Management Center > Data Source Management.
On the Data Source page, click + New Data Source.
On the New Data Source page, in the Relational Database area, select PolarDB-X 2.0.
If you have recently used PolarDB-X 2.0, you can also select it from the Recently Used area. Alternatively, enter `PolarDB-X 2.0` in the search box to find it quickly.
On the Create PolarDB-X 2.0 Data Source page, configure the data source connection parameters.
Configure the basic information of the data source.
Parameter
Description
Datasource Name
Enter a name for the data source. The naming convention is as follows:
The name can contain only Chinese characters, uppercase and lowercase letters, digits, underscores (_), and hyphens (-).
The name can be up to 64 characters long.
Datasource Code
After you configure the data source code, you can directly access Dataphin data source tables in Flink_SQL tasks or using the Dataphin Java Database Connectivity (JDBC) client. Use the format
data_source_code.table_nameordata_source_code.schema.table_name. To automatically switch data sources based on the task execution environment, use the variable format${data_source_code}.tableor${data_source_code}.schema.table. For more information, see Develop with Dataphin data source tables.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 inventory only after the data source code is configured.
In Flink SQL, only MySQL, Hologres, MaxCompute, Oracle, StarRocks, Hive, and SelectDB data sources are supported.
Data Source Description
A brief description of the data source. The description cannot exceed 128 characters.
Data Source Configuration
Select the data source to configure:
If your business data source is separated into production and development data sources, select Production + Development Data Source.
If your business data source is not separated, select Production Data Source.
Tag
You can add tags to the data source for categorization. For information about how to create tags, see Manage data source tags.
Configure the connection parameters for the data source to connect to Dataphin.
If you set Data Source Configuration to Production + Development Data Source, configure the connection information for both the production and development data sources. If you set it to Production Data Source, configure the connection information only for the production data source.
NoteTypically, the production and development data sources should be different to isolate the environments and reduce the impact of the development environment on the production environment. However, Dataphin lets you configure them as the same data source using the same parameter values.
Parameter
Description
JDBC URL
The endpoint format is
jdbc:mysql://host:port/dbname.Username, Password
The username and password to log on to the database.
Configure advanced settings.
Parameter
Description
connectTimeout
The database connection timeout period in milliseconds (ms). The default value is 900000 ms (15 minutes).
NoteIf you include a connectTimeout configuration in the JDBC URL, the timeout period specified in the URL is used.
For data sources created in Dataphin versions earlier than V3.11, the default connectTimeout is
-1, which indicates no timeout limit.
socketTimeout
The database socket timeout period in milliseconds (ms). The default value is 1800000 ms (30 minutes).
NoteIf you include a socketTimeout configuration in the JDBC URL, the timeout period specified in the URL is used.
For data sources created in Dataphin versions earlier than V3.11, the default socketTimeout is
-1, which indicates no timeout limit.
Connection Retries
If the database connection times out, the system automatically retries the connection until the specified number of retries is reached. If the connection still fails after the maximum number of retries, the connection attempt fails.
NoteThe default number of retries is 1. You can set this parameter to a value from 0 to 10.
The number of connection retries applies by default to offline integration tasks and global quality checks. The global quality check feature requires the Asset Quality module to be activated. For offline integration tasks, you can configure the number of retries at the task level.
Select the Default Resource Group. This resource group is used to run tasks related to the current data source, such as database SQL, offline full database migration, and data preview.
Click Test Connection, or click OK to save the configuration and create the PolarDB-X 2.0 data source.
When you click Test Connection, the system checks whether the data source can connect to Dataphin. If you click OK directly, the system automatically tests the connection for all selected clusters. The data source can be created even if all selected clusters fail the connection test.
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
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.
NoteOnly 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
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
icon to view the log information.