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 have familiarized yourself with the compatibility of DBeaver with AnalyticDB for MySQL. For more information, see Compatibility overview.
  • MySQL Connector/J 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 the AnalyticDB for MySQL cluster. For more information, see Configure a whitelist.
  • A public endpoint is applied for if you need to use a public endpoint to connect to AnalyticDB for MySQL clusters. 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 If you use SQL Workbench/J for the first time, 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 that appears, 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 that appears, configure the connection parameters.
    Configuration parameters
    Parameter Description
    New profile The name of the connection. We recommend that you choose an identifiable name to facilitate subsequent management.
    Driver Select MySQL.
    URL The connection string of the AnalyticDB for MySQL cluster to which you want to connect. The format is jdbc:mysql://hostname:port/name_of_database.
    • hostname: the public or VPC endpoint of the cluster.
    • port: the port number of the AnalyticDB for MySQL cluster endpoint. The default port number is 3306.
    • name_of_database: the name of the database in the cluster. This parameter is optional.
    Username The account used to connect to the AnalyticDB for MySQL cluster. You can use one of the following accounts:
    • 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 to test connectivity. After the connection passes the test, click OK to connect to the AnalyticDB for MySQL cluster.