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

  • MySQL nodes can use only exclusive resource groups for scheduling. For more information about how to create and use an exclusive resource group for scheduling, see Create and use an exclusive resource group for scheduling.
  • A MySQL data source is added by using the connection string mode. For more information, see Configure a MySQL data source. Make sure that the data source that you created is connected to the exclusive resource group for scheduling.

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 following the operations in Configure a MySQL data source. On the Data Source page, find your desired data source, and 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 the 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.
Note The current node type does not support MySQL 8.0 or later.

Proposals and suggestions for network connections

This section describes the proposals and suggestions for network connections.
  • Resources in exclusive resource groups for scheduling can be scheduled on demand to ensure the outputs of the 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 the shared 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, set the Workflow Name parameter.
    3. Click Create.
  3. Create a MySQL node.
    1. Move the pointer over the Create icon and choose Database > MySQL.
      You can also right-click the name of the workflow that you created and then choose Create > Database > MySQL.
    2. In the Create Node dialog box, set the Node Name, Node Type, and Location parameters.
      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 data source that you want to use to develop data from the Select Data Source drop-down list. If you cannot find the required data source in the drop-down list, click Add Data Source 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 following the operations in Configure a MySQL data source. On the Data Source page, find your desired data source, and 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 with Parameters icon. In the Parameters 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 the 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 select a different resource group in the Parameters dialog box.
    3. Use SQL statements to create a task.
      Write 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 write SQL statements that you want to execute based on your business requirements and the syntax that is supported by MySQL.
      select * from xc_emp;
      The following figure shows the results. Results
      If the task execution fails, you can view the error message and troubleshoot the issues based on the instructions in If the node fails to run, the system displays the following error message: sql execute failed! What do I do if the JDBC driver is not supported?.
    4. Save and execute the SQL statements.
      In the top toolbar, click the Save icon to save the SQL statements. Then, click the Run icon to execute the SQL statements.
  5. Configure scheduling properties for the MySQL node.
    If you want the system to periodically run the MySQL node, 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 workspace in standard mode, you must deploy the node in the production environment after you commit the node. 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. For more information, see View auto triggered nodes.

If the node fails to run, the system displays the following error message: sql execute failed! What do I do if the JDBC driver is not supported?

  • Problem description

    When I configure a MySQL data source that is not added by using the connection string mode, the node fails to run, and the system displays the following error message: sql execute failed! The JDBC 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 following the operations in Configure a MySQL data source. On the Data Source page, find your desired data source, and click Edit in the Operation column to view the mode that is used to add the data source.