SQL Workbench/J is a DBMS-independent, cross-platform SQL query tool. This topic describes how to use SQL Workbench/J to connect to an AnalyticDB for MySQL cluster.

Prerequisites

Before you use SQL Workbench/J, make sure that the following requirements are met:

  • You are familiar with the compatibility between SQL WorkBench/J and AnalyticDB for MySQL. For more information, see Compatibility overview.
  • MySQL JDBC is installed.
  • SQL Workbench/J is installed. The IP address of the device on which SQL WorkBench/J is installed is added to the whitelist of an AnalyticDB for MySQL cluster. For more information, see Configure a whitelist.
  • A public endpoint is obtained for the AnalyticDB for MySQL cluster if you want to connect to the cluster over the Internet. For more information, see Apply for or release a public endpoint.

Precautions

For information about how to enable PrepareStatement in SQL Workbench/J, see Enable PrepareStatement for a client in different programming languages.

Procedure

  1. Start SQL Workbench/J and choose File > Manage Drivers.
    Note The first time you use SQL Workbench/J, you must add the JDBC driver and its JAR file. When you use SQL Workbench/J later, you can skip Steps 1 and 2.
  2. In the Manage drivers dialog box, select MySQL as the driver, add the JAR file of the driver, and then click OK.
    Create a connection
  3. Choose File > Connect window. In the Select Connection Profile dialog box, configure the parameters described in the following table.
    Configure parameters
    Parameter Description
    New profile The name of the connection. We recommend that you set a descriptive name that makes it easy to identify.
    Driver Select MySQL.
    URL

    The endpoint used to connect to the AnalyticDB for MySQL cluster. You can view the connection information about the cluster on the Cluster Information page of the AnalyticDB for MySQL console.

    Username
    The name of the account used to connect to the AnalyticDB for MySQL cluster. You can use one of the following account types:
    • Privileged account
    • Standard account
    Password

    The password of the account used to connect to the AnalyticDB for MySQL cluster.

  4. After you configure the preceding parameters, click Test Connection. After the connection passes the test, click OK to connect to the AnalyticDB for MySQL cluster.