Updated on 2022-12-08 GMT+08:00

Creating a MySQL Connection

This section describes how to create a MySQL connection between DataArts Studio and the data lake base.

Prerequisites

  • You have created a data lake to connect, for example, a database or cloud service supported by DataArts Studio.
    • Before creating a DWS data connection, ensure that you have created a cluster in DWS and have the permissions required to view Key Management Service (KMS) keys.
    • Before creating an MRS HBase, MRS Hive, MRS Kafka, MRS Presto, or MRS Spark connection, ensure that you have created an MRS cluster and selected required components.
    • Before creating an RDS data connection, ensure that you have created an RDS DB instance. Currently, DataArts Studio supports only MySQL and PostgreSQL databases in RDS.
  • The data lake to connect communicates with the DataArts Studio instance properly.
    • If the data lake is an on-premises database, a public network or a dedicated connection is required. Ensure that the host where the data source is located can access the public network and the port has been enabled in the firewall rule.
    • If the data lake is a cloud service (such as DWS and MRS), the following requirements must be met for network interconnection:
      • If the CDM cluster in the DataArts Studio instance and the cloud service are in different regions, a public network or a dedicated connection is required.
      • If the CDM cluster in the DataArts Studio instance and the cloud service are in the same region, VPC, subnet, and security group, they can communicate with each other by default. If they are in the same VPC but in different subnets or security groups, you must configure routing rules and security group rules. For details about how to configure routing rules, see Adding Routes in Virtual Private Cloud (VPC) Usage Guide. For details about how to configure security group rules, see Security Group > Adding a Security Group Rule in Virtual Private Cloud (VPC) Usage Guide.
      • The cloud service instance and the DataArts Studio workspace belong to the same enterprise project. If they do not, you can modify the enterprise project of the workspace.

Creating a Data Connection

  1. On the DataArts Studio console, locate a workspace and click Management Center.
    Figure 1 Management Center
  1. In the navigation pane, choose Manage Data Connections.
    Figure 2 Creating a Data Connection
  1. On the Manage Data Connections page, click Create Data Connection. In the displayed dialog box, select RDS for Data Connection Type and set other parameters based on the descriptions in Table 1.
    Figure 3 Create Data Connections
    • You are not advised to select MySQL (pending offline) for Data Connection Type. Instead, You are advised to select RDS.
    • RDS data connections depend on OBS. If OBS is unavailable in the same region as DataArts Studio, RDS data connections are not supported.
    Figure 4 RDS connection parameters
    Table 1 RDS data connection

    Parameter

    Mandatory

    Description

    Data Connection Name

    Yes

    The name of the data connection to create. Data connection names can contain 1 to 50 characters. They can include only letters, numbers, underscores (_), and hyphens (-).

    Tag

    No

    The attribute of the data connection to create. Tags make management easier.

    NOTE:

    The name of the tag. Only letters, numbers, and underscores (_) are allowed. Tag names cannot start with underscores (_). Enter up to 100 characters.

    IP

    Yes

    The address for accessing RDS.

    If the data source is RDS, you can obtain the address from the RDS console.

    1. Log in to the management console using the created account.
    2. In the Service List, choose Relational Database Service. In the left navigation pane, choose Instances.
    3. Click the name of an instance. The basic information page of the instance is displayed.

    You can obtain the IP address on the Connection Information tab.

    Port

    Yes

    The port for accessing RDS.

    If the data source is RDS, you can obtain the port from the RDS console.

    1. Log in to the management console using the account.
    2. In the Service List, choose Relational Database Service. In the left navigation pane, choose Instances.
    3. Click the name of an instance. The basic information page of the instance is displayed.

    You can obtain the database port on the Connection Information tab.

    Driver Name

    Yes

    The name of the driver. The following values are available:

    • com.mysql.jdbc.Driver
    • org.postgresql.Driver

    Driver File Path

    Yes

    Path of the driver file in the OBS bucket. You need to download the .jar driver file from the corresponding official website and upload it to the OBS bucket.

    NOTE:

    To update the driver, you must restart the CDM cluster in DataArts Migration and then edit the data connection to upload the driver.

    Username

    Yes

    The username of the database. The username is required for creating a cluster.

    Password

    Yes

    The password for accessing the database. The password is required for creating a cluster.

    KMS Key

    Yes

    Name of the KMS key.

    To obtain the key:

    1. Log in to the management console using the account.
    2. Click Key Management Service and select Key Management Service from the list on the left.

    You can obtain the key name from the key list.

    Agent

    Yes

    RDS is not a fully managed service and cannot be directly connected to DataArts Studio. A CDM cluster can provide an agent for DataArts Studio to communicate with non-fully-managed services. Therefore, you need to select a CDM cluster when creating an RDS data connection. If no CDM cluster is available, create one through the DataArts Migration incremental package.

    As a network proxy, the CDM cluster must be able to communicate with RDS. To ensure network connectivity, the CDM cluster must be in the same region, AZ, VPC, and subnet as RDS. The security group rule must also allow the CDM cluster to communicate with RDS.

  2. Click Test to test connectivity of the data connection. If the test fails, the data connection fails to be created.
  3. After the test is successful, click OK to create the data connection.

Reference

  1. What Are the Precautions for Creating an RDS Data Connection?

    When creating an RDS data connection, you need to bind an agent provided by the CDM cluster. Currently, a version of the CDM cluster earlier than 1.8.6 is not supported.