Create A Microsoft SQL Server Data Source
This topic describes how to create a Microsoft SQL Server data source, which enables Dataphin to read from and write to your Microsoft SQL Server database.
Permissions
Only custom global roles with the Create data source permission and users with the Super administrator, Data source administrator, Business segment architect, or Project administrator role can create data sources.
Procedure
On the Dataphin homepage, choose Management Center > Data Source Management in the top navigation bar.
On the Data Source page, click + New Data Source.
On the New Data Source page, in the Relational databases section, select Microsoft SQL Server.
If you have recently used Microsoft SQL Server, you can select it from the Recently used section or find it by using the search box.
On the New Microsoft SQL Server data source page, configure the connection parameters for the data source.
Configure basic data source information.
Parameter
Description
Data source name
Enter a name for the data source. The name must meet the following requirements:
Can contain only Chinese characters, letters, digits, underscores (_), and hyphens (-).
Cannot exceed 64 characters in length.
Data source code
After you configure the data source code, you can use the
ordata_source_code.table_nameformat to directly access tables in the Dataphin data source from Flink SQL tasks or the Dataphin JDBC client. To automatically switch data sources based on the task execution environment, use the variable formatdata_source_code.schema.table_nameor${data_source_code}.table. For more information, see Methods for developing with Dataphin data source tables.${data_source_code}.schema.tableImportant-
The 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
Select the version of Microsoft SQL Server. The default is SQL Server 2008. You can select SQL Server 2008 or SQL Server 2012 or later.
Data source description
Enter a brief description for the data source, up to 128 characters.
Time zone
Dataphin uses the selected time zone to process time-based data in integration tasks. The default time zone is Asia/Shanghai. Click Modify to select a different time zone. The available options are:
GMT: GMT-12:00, GMT-11:00, GMT-10:00, GMT-09:30, GMT-09:00, GMT-08:00, GMT-07:00, GMT-06:00, GMT-05:00, GMT-04:00, GMT-03:00, GMT-03:00, GMT-02:30, GMT-02:00, GMT-01:00, GMT+00:00, GMT+01:00, GMT+02:00, GMT+03:00, GMT+03:30, GMT+04:00, GMT+04:30, GMT+05:00, GMT+05:30, GMT+05:45, GMT+06:00, GMT+06:30, GMT+07:00, GMT+08:00, GMT+08:45, GMT+09:00, GMT+09:30, GMT+10:00, GMT+10:30, GMT+11:00, GMT+12:00, GMT+12:45, GMT+13:00, GMT+14:00.
Daylight Saving Time: Africa/Cairo, America/Chicago, America/Denver, America/Los_Angeles, America/New_York, America/Sao_Paulo, Asia/Bangkok, Asia/Dubai, Asia/Kolkata, Asia/Shanghai, Asia/Tokyo, Atlantic/Azores, Australia/Sydney, Europe/Berlin, Europe/London, Europe/Moscow, Europe/Paris, Pacific/Auckland, Pacific/Honolulu.
Data source configuration
Select the data source environment to configure:
If you separate your business data into production and development environments, select Production + development data source.
If you do not separate your business data into different environments, select Production data source.
Tags
Add tags to classify the data source. For information about how to create a tag, see Manage data source tags.
Configure connection parameters.
If you selected Production + development data source for Data source configuration, you must configure connection information for both the production and development environments. If you selected Production data source, you only need to configure connection information for the production environment.
NoteTypically, you should configure the production and development data sources as separate databases to isolate the environments and reduce the impact of development activities. However, Dataphin also lets you use the same database for both by entering identical parameter values.
For Configuration Method, select either JDBC URL or Host. JDBC URL is the default.
JDBC URL
Parameter
Description
JDBC URL
The format of the connection URL is
.jdbc:sqlserver://host:port/dbnameSchema
Enter the schema associated with the username.
Username, Password
Enter the username and password for the target database.
SSL Encryption
Select whether to connect to the database by using SSL encryption. The default is Disable. You can select Disable or Enable. If you enable this option, you must configure Certificate Verification. Enabling SSL encrypts data in transit and is suitable for scenarios with high data security requirements, but it may impact connection performance. If the database is in a trusted environment, such as an internal network, you can leave this option disabled.
NoteOnly SQL Server 2012 or later data sources support SSL encryption. If you enable SSL encryption for a SQL Server 2008 data source, the configuration cannot be saved. You must either switch the version or disable SSL encryption.
If you manually specify SSL-related parameters such as
encryptortrustServerCertificatein the JDBC URL or host configuration parameters, the form settings for SSL Encryption and Certificate Verification override them in the event of a conflict.Real-time integration (CDC) scenarios do not support SSL encryption.
Certificate Verification
Select whether to verify the server certificate. The default is Do not verify server certificate. You can select Do not verify server certificate or Verify server certificate. If you select Verify server certificate, Dataphin validates the server's certificate chain and hostname. You must configure the CA certificate file and can also configure the Certificate password and Certificate hostname. Verifying the server certificate helps prevent man-in-the-middle attacks and ensures a trusted connection, making it suitable for high-security scenarios such as security audits. Skipping verification simplifies setup and is suitable for trusted environments like internal networks.
CA certificate file
Required when you select Verify server certificate. Upload the CA certificate file used to validate the server certificate chain and hostname. Only
truststore files are supported. The file size cannot exceed 2 MB. You must convert files in other formats, such as.jks,.cer,.crt, or.pem, to the JKS truststore format before uploading. For security reasons, you cannot download the certificate file after uploading it. Keep a local copy of your certificate file..pfxCertificate password (Optional)
Enter the password for the uploaded JKS truststore. Dataphin stores the password in encrypted form.
Certificate hostname (Optional)
Enter the hostname of the server certificate, for example,
. If you leave this blank, the connection address is used by default for hostname verification.sqlserver.example.comHost
Host configuration
Parameter
Description
Server address
Enter the IP address and port number of the server.
You can click + Add to add multiple IP addresses and port numbers. Click the
icon to remove extra entries, but you must keep at least one.dbname
Enter the name of the database.
Parameter configuration
Parameter
Description
Parameter
Parameter name: You can select an existing parameter name or enter a custom one.
Custom parameter names can contain only letters, digits, periods (.), underscores (_), and hyphens (-).
Parameter value: This parameter is required if a parameter name is selected. The value can contain only letters, digits, periods (.), underscores (_), and hyphens (-), and can be up to 256 characters long.
NoteYou can click + Add Parameter to add more parameters and click the
icon to remove them. You can add up to 30 parameters.Schema
Enter the schema associated with the username.
Username, Password
The username and password used to log on to the Microsoft SQL Server instance.
SSL Encryption
Select whether to connect to the database by using SSL encryption. The default is Disable. You can select Disable or Enable. If you enable this option, you must configure Certificate Verification. Enabling SSL encrypts data in transit and is suitable for scenarios with high data security requirements, but it may impact connection performance. If the database is in a trusted environment, such as an internal network, you can leave this option disabled.
NoteOnly SQL Server 2012 or later data sources support SSL encryption. If you enable SSL encryption for a SQL Server 2008 data source, the configuration cannot be saved. You must either switch the version or disable SSL encryption.
If you manually specify SSL-related parameters such as
encryptortrustServerCertificatein the JDBC URL or host configuration parameters, the form settings for SSL Encryption and Certificate Verification override them in the event of a conflict.Real-time integration (CDC) scenarios do not support SSL encryption.
Certificate Verification
Select whether to verify the server certificate. The default is Do not verify server certificate. You can select Do not verify server certificate or Verify server certificate. If you select Verify server certificate, Dataphin validates the server's certificate chain and hostname. You must configure the CA certificate file and can also configure the Certificate password and Certificate hostname. Verifying the server certificate helps prevent man-in-the-middle attacks and ensures a trusted connection, making it suitable for high-security scenarios such as security audits. Skipping verification simplifies setup and is suitable for trusted environments like internal networks.
CA certificate file
Required when you select Verify server certificate. Upload the CA certificate file used to validate the server certificate chain and hostname. Only
truststore files are supported. The file size cannot exceed 2 MB. You must convert files in other formats, such as.jks,.cer,.crt, or.pem, to the JKS truststore format before uploading. For security reasons, you cannot download the certificate file after uploading it. Keep a local copy of your certificate file..pfxCertificate password (Optional)
Enter the password for the uploaded JKS truststore. Dataphin stores the password in encrypted form.
Certificate hostname (Optional)
Enter the hostname of the server certificate, for example,
. If you leave this blank, the connection address is used by default for hostname verification.sqlserver.example.com
NoteIf you configure the instanceName parameter, it takes precedence, and the configured port is ignored.
If you create a data source by using the host configuration method and then switch to the JDBC URL configuration method, Dataphin automatically populates the JDBC URL by concatenating the server's IP address and port.
Configure advanced data source settings.
Parameter
Description
loginTimeout
The database login timeout, in seconds. The default is 900 seconds (15 minutes).
NoteIf you include a
loginTimeoutsetting in the JDBC URL, the value in the JDBC URL is used.For data sources created before Dataphin V3.11, the default
loginTimeoutis-1, which means no timeout.
socketTimeout
The database socket timeout, in milliseconds. The default is 1,800,000 milliseconds (30 minutes).
NoteIf you include a
socketTimeoutsetting in the JDBC URL, the value in the JDBC URL is used.For data sources created before Dataphin V3.11, the default
socketTimeoutis-1, which means no timeout.
Connection retries
The number of times Dataphin automatically retries a timed-out connection. If all retries fail, the connection attempt is marked as failed.
NoteThe default is 1 retry. You can set this parameter to a value from 0 to 10.
The connection retry count applies by default to batch integration tasks and global quality checks (requires the Asset Quality feature module). You can configure task-level retries separately in batch integration tasks.
NoteThe following rules determine the value of a duplicate parameter if it is configured in multiple places:
If a parameter is set in the JDBC URL, Advanced settings, and Host configuration, the value in the JDBC URL takes precedence.
If a parameter is set in both the JDBC URL and Advanced settings, the value in the JDBC URL takes precedence.
If a parameter is set in both the Advanced settings and the Host configuration, the value in the Advanced settings takes precedence.
Select a Default resource group. This resource group runs tasks related to the data source, such as executing SQL, performing batch database migrations, and previewing data.
Click Test Connection or click OK to save the configuration and create the Microsoft SQL Server data source.
Clicking Test Connection prompts Dataphin to test the connection to the data source. If you click OK directly, the system automatically tests the connection for all selected clusters. You can still create the data source even if the connection test fails for all selected clusters.
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 used only to test network connectivity and are not used for running tasks.
-
The test connection usually completes within 2 minutes. If it times out, click the
icon to view the reason and retry. -
Regardless of the test result (Connection Failed, Connection Successful, or Succeeded With Warning), the system records the timestamp 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, click the
icon to view the failure reason. -
When the test result is Succeeded With Warning, the application cluster connection succeeded but the scheduling cluster connection failed. The data source cannot be used for data development and integration. Click the
icon to view the log information.
-