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-dependenciespackage). This topic uses V3.2.9SQL Workbench/J installed. This topic uses Build 127 (2020-08-22)
Java 8 or later installed
Step 1: Add the MaxCompute JDBC driver
Start SQL Workbench/J. The Select Connection Profile dialog box opens automatically.
In the lower-left corner of the dialog box, click Manage Drivers.
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.
Step 2: Connect SQL Workbench/J to MaxCompute
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:Parameter Description Driver The MaxCompute JDBC driver registered in Step 1. Select com.aliyun.odps.jdbc.OdpsDriverfrom the Driver drop-down list.URL The JDBC connection URL. See the URL format below. Username Your AccessKey ID. Password Your AccessKey secret. Field Description <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=trueto the URL:jdbc:odps:<MaxCompute_endpoint>?project=<MaxCompute_project_name>&interactiveMode=true
Click Test. If the connection test succeeds, click OK.

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;
View a table schema
desc <table_name>;
Query table data
SELECT * FROM <table_name>;