Create a PolarDB-X 2.0 data source to allow Dataphin to read business data from and 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 name must meet the following requirements:
-
Can contain only Chinese characters, uppercase and lowercase letters, digits, underscores (_), and hyphens (-).
-
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 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.
Data Source Description
A brief description of the data source, up to 128 characters.
Data Source Configuration
Select the data source configuration:
-
If your business data source uses separate production and development environments, select Production + Development Data Source.
-
If your business data source does not use separate environments, select Production Data Source.
Tag
You can add tags to the data source for categorization. For more information about creating 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, production and development data sources should be different to isolate environments and reduce the impact of development on production. However, Dataphin allows you to configure them as the same data source with identical parameter values.
Parameter
Description
JDBC URL
The JDBC URL format is
jdbc:mysql://host:port/dbname.Username, Password
The username and password used to log on to the database.
-
Configure advanced settings.
Parameter
Description
connectTimeout
The database connection timeout period, in milliseconds (ms). Default value: 900000 ms (15 minutes).
Note-
If 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). Default value: 1800000 ms (30 minutes).
Note-
If 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 retries automatically up to the specified number of times. If the connection still fails after all retries, the connection attempt fails.
Note-
The default retry count is 1, with a valid range of 0 to 10.
-
Connection retries apply by default to offline integration tasks and global quality checks. The global quality check feature requires the Asset Quality module. For offline integration tasks, you can configure retries at the task level.
-
-
-
Select the Default Resource Group. This resource group runs tasks related to the current data source, such as database SQL queries, 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 verifies that 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.