You can create a MySQL node and use SQL statements to develop data for a MySQL data source. This topic describes how to create and use a MySQL node.

Prerequisites

Limits

  • MySQL nodes can be used to develop data only for MySQL data sources that are added by using the connection string mode. You can go to the Data Source page by referring to the operations in Configure a MySQL data source and find your desired data source. Then, click Edit in the Operation column to view the mode that is used to add the data source.

  • If you want to access the MySQL data source over the Internet, you must configure a whitelist for the data source. To ensure the connectivity between the resource group and data source, we recommend that you use an exclusive resource group for scheduling.
  • If you want to access the MySQL data source over a virtual private cloud (VPC), you can use only an exclusive resource group for scheduling to develop data.

Proposals and suggestions for network connections

This section provides the following proposals and suggestions for network connections:
  • Resources of exclusive resource groups for scheduling can be scheduled at all times to ensure the outputs of nodes. We recommend that you use exclusive resource groups for scheduling to run nodes.
  • If you want to access the MySQL data source over a VPC, use an exclusive resource group for scheduling.
  • If you want to access the MySQL data source over the Internet, we recommend that you use an exclusive resource group for scheduling.
  • If you want to use a public resource group for scheduling to access the MySQL data source over the Internet, you must configure a whitelist for the data source.

Create and use a MySQL node to develop data

  1. Go to the DataStudio page.
    1. Log on to the DataWorks console.
    2. In the left-side navigation pane, click Workspaces.
    3. In the top navigation bar, select the region where your workspace resides, find the workspace, and then click Data Analytics in the Actions column.
  2. Create a workflow.
    If you have a workflow, skip this step.
    1. Move the pointer over the Create icon and select Workflow.
    2. In the Create Workflow dialog box, specify Workflow Name.
    3. Click Create.
  3. Create a MySQL node.
    1. Move the pointer over the Create icon and choose Database > MySQL.
      You can also find the newly created workflow, right-click the workflow name, and then choose Create > Database > MySQL.
    2. In the Create Node dialog box, specify Node Name, Node Type, and Location.
      Note The node name must be 1 to 128 characters in length and can contain letters, digits, underscores (_), and periods (.).
    3. Click Commit to go to the editing tab of the MySQL node.
  4. Use the MySQL node to develop data.
    1. Select a data source.
      Select the required data source that needs to be used for data development from the Select Data Store drop-down list. If you cannot find the required data source in the drop-down list, click Add Connection and add a data source on the Data Source page. For more information, see Configure a MySQL data source.
      Note

      MySQL nodes can be used to develop data only for MySQL data sources that are added by using the connection string mode. You can go to the Data Source page by referring to the operations in Configure a MySQL data source and find your desired data source. Then, click Edit in the Operation column to view the mode that is used to add the data source.

    2. Select a resource group.
      In the top toolbar, click the Run icon. In the Arguments dialog box, select the created resource group for scheduling.
      Note
      • If you want to access a data source over the Internet or a VPC, you must use a resource group for scheduling that is connected to the data source. For more information, see Select a network connectivity solution.
      • If you want to change the resource group in subsequent operations, you can also perform the change in the Arguments dialog box.
    3. Use SQL statements to create a task.
      Compile SQL statements in the SQL editor to create a task. SQL editor
      In this example, the following statement is used to query data in the xc_emp table: You can compile SQL statements that you want to execute based on the syntax supported by MySQL and your business requirements.
      select * from xc_emp;
      The following figure shows the results. Results
      If the running of the task fails, you can view the error message and troubleshoot the issues based on the instructions in The system displays the following error message for a node to indicate that the node fails to run: sql execute failed! The JDBC driver is not supported. What do I do?.
    4. Save and execute the SQL statement.
      In the top toolbar, click the Save icon to save the compiled SQL statement. Then, click the Run icon to execute the SQL statement.
  5. Configure scheduling properties for the MySQL node.
    If you want the system to run the MySQL node periodically, you can click Properties in the right-side navigation pane to configure scheduling properties for the node based on your business requirements.
  6. Commit and deploy the MySQL node.
    1. Click the Save icon in the top toolbar to save the node.
    2. Click the Submit icon in the top toolbar to commit the node.
    3. In the Commit Node dialog box, enter your comments in the Change description field.
    4. Click OK.
    If you use a standard-mode workspace, the node is deployed in the production environment after the node is committed. Click Deploy in the upper-right corner. For more information, see Deploy nodes.
  7. View the MySQL node.
    1. On the editing tab of the MySQL node, click Operation Center in the upper-right corner to go to Operation Center.
    2. View the scheduled MySQL node that is running. For more information, see View auto triggered nodes.

The system displays the following error message for a node to indicate that the node fails to run: sql execute failed! The JDBC driver is not supported. What do I do?

  • Problem description

    When I configure the MySQL data source, I select a data source that is not added by using the connection string mode. As a result, the node fails to run, and the system displays the following error message: sql execute failed! The JDBS driver is not supported..

  • Cause

    A MySQL data source that is not added by using the connection string mode is used.

  • Solution

    Select a data source that is added by using the connection string mode. You can go to the Data Source page by referring to the operations in Configure a MySQL data source and find your desired data source. Then, click Edit in the Operation column to view the mode that is used to add the data source.