All Products
Search
Document Center

MaxCompute:Connect SQL Workbench/J to MaxCompute

Last Updated:Mar 25, 2026

Use the MaxCompute Java Database Connectivity (JDBC) driver to connect SQL Workbench/J to your MaxCompute project and run SQL queries directly from the tool.

Prerequisites

Before you begin, ensure that you have:

  • A MaxCompute project. See Create a MaxCompute project

  • The AccessKey ID and AccessKey secret of the Alibaba Cloud account used to access the project. Go to profile picture > AccessKey Management in the MaxCompute console to get your credentials

  • The MaxCompute JDBC driver JAR package (V3.0.1 or later, including the jar-with-dependencies package). This topic uses V3.2.9

  • SQL Workbench/J installed. This topic uses Build 127 (2020-08-22)

  • Java 8 or later installed

Step 1: Add the MaxCompute JDBC driver

  1. Start SQL Workbench/J. The Select Connection Profile dialog box opens automatically.

  2. In the lower-left corner of the dialog box, click Manage Drivers.

  3. In the Manage Drivers dialog box, enter a name for the driver in the Name field, upload the MaxCompute JDBC driver JAR package, and then click OK. After the JAR package is uploaded, the Classname field is automatically set to com.aliyun.odps.jdbc.OdpsDriver.

    Add JDBC driver

Step 2: Connect SQL Workbench/J to MaxCompute

  1. In the Select Connection Profile dialog box, enter a connection name (for example, MCtoSQL) and configure the following parameters. JDBC URL format Use the following format for required parameters:

    ParameterDescription
    DriverThe MaxCompute JDBC driver registered in Step 1. Select com.aliyun.odps.jdbc.OdpsDriver from the Driver drop-down list.
    URLThe JDBC connection URL. See the URL format below.
    UsernameYour AccessKey ID.
    PasswordYour AccessKey secret.
    FieldDescription
    <MaxCompute_endpoint>The endpoint of your MaxCompute project's region. For a full list of endpoints by region, see Endpoints.
    <MaxCompute_project_name>The name of your MaxCompute project — not the DataWorks workspace name. To find the project name, go to the MaxCompute console, select your region in the top navigation bar, and check the Project management tab.
    jdbc:odps:<MaxCompute_endpoint>?project=<MaxCompute_project_name>

    Optional: Enable MaxCompute Query Acceleration (MCQA) To enable MCQA, append &interactiveMode=true to the URL:

    jdbc:odps:<MaxCompute_endpoint>?project=<MaxCompute_project_name>&interactiveMode=true

    Configure connection parameters

  2. Click Test. If the connection test succeeds, click OK.

    Connection test success

Step 3: Query and manage data

After connecting, SQL Workbench/J opens the SQL execution page. Run MaxCompute SQL statements to interact with your project.

List all tables

show tables;
List all tables

View a table schema

desc <table_name>;
View table schema

Query table data

SELECT * FROM <table_name>;
Query table data