MaxCompute allows you to use the database management tool DBeaver to access MaxCompute projects and manage data. This topic describes how to use a MaxCompute Java Database Connectivity (JDBC) driver to connect DBeaver to a MaxCompute project and use DBeaver to manage data.
Background information
DBeaver is a multi-platform database management tool for developers, database administrators, analysts, and personnel who need to use databases. Users can use DBeaver free of charge. For more information about DBeaver, see DBeaver.
Prerequisites
A MaxCompute project is created.
For more information on creating a MaxCompute project, see Create a MaxCompute project.
The AccessKey pair of your Alibaba Cloud account that is used to access the MaxCompute project is obtained.
You can click the profile picture in the upper-right corner of the MaxCompute console and select AccessKey Management to obtain the AccessKey pair.
The JAR package, jar-with-dependencies, is downloaded.
Click odps-jdbc-3.9.0.jar to download it, or retrieve the latest version of the MaxCompute JAR package from GitHub or the Maven repository. MaxCompute JDBC driver v3.9.0 is used in this topic.
DBeaver is downloaded and installed.
For more information about how to install DBeaver, see Install.
DBeaver Community Edition 24.3.1 is used in this topic.
Step 1: Connect DBeaver to MaxCompute
Launch DBeaver and navigate to its interface.
In the top menu bar, click . In the Select your database dialog box, choose , then click Next.
On the Main tab of the Generic JDBC Connection Settings dialog box, click Edit Driver Settings. In the dialog box that appears, click the Libraries tab and click Add File to associate the JAR package of the MaxCompute JDBC driver with the libraries of the data source. The driver package
odps-jdbc-3.9.0-rc4-jar-with-dependencies.jar
is used in this topic.On the Main tab of the Generic JDBC Connection Settings dialog box, click Edit Driver Settings again. In the dialog box that appears, click the Settings tab, enter com.aliyun.odps.jdbc.OdpsDriver in the Class Name field, enter jdbc:odps:{file} in the URL Template field, and then click OK.
After you modify and save the data source configurations, the data source supports the MaxCompute JDBC driver.
In the General JDBC Connection Settings dialog box, complete the General tab by entering the JDBC URL details.
Parameter
Description
Path
The URL that is used to connect to the MaxCompute project. The format is
<MaxCompute_endpoint>?project=<MaxCompute_project_name>&accessId=<access_id>&accessKey=<access_key>[&interactiveMode={true|false}]
. Delete the angle brackets (<>
) when you configure this parameter. Parameters:<MaxCompute_endpoint>: required. The endpoint of MaxCompute. Configure this parameter based on the region where the MaxCompute project resides.
For more information about the endpoints of MaxCompute in different regions, see Endpoints.
<MaxCompute_project_name>: required. The name of the MaxCompute project.
This parameter specifies the name of your MaxCompute project instead of the DataWorks workspace to which the MaxCompute project corresponds. You can log on to the MaxCompute console, select the region where your MaxCompute project resides in the top navigation bar, and then view the name of the MaxCompute project on the Project management tab.
access_id: required. The AccessKey ID that is used to access the MaxCompute project.
You can click the profile picture in the upper-right corner of the MaxCompute console and select AccessKey Management to obtain the AccessKey ID.
access_key: required. The AccessKey secret that corresponds to the AccessKey ID.
You can click the profile picture in the upper-right corner of the MaxCompute console and select AccessKey Management to obtain the AccessKey secret.
interactiveMode: optional. This parameter specifies whether to enable the MaxCompute Query Acceleration (MCQA) feature.
If you want to enable the MCQA feature, add
&interactiveMode=true
to the end of the URL. For more information about the MCQA feature, see Query acceleration.
Click Test Connection. Once the connection is successfully established, click OK, followed by Finish, to finalize the connection setup between DBeaver and MaxCompute.
Step 2: Use DBeaver to query and analyze data
After you connect DBeaver to MaxCompute, you can view the established MaxCompute connection in the left-side navigation tree of DBeaver and manage the MaxCompute project by using the SQL feature. You can perform the following operations based on your business requirements. For more information about these operations, see the DBeaver help information.
Query all existing tables
You can query the information of all existing tables that are listed under the established MaxCompute connection.
Query table schema
You can right-click the table that you want to query under the established MaxCompute connection and select View Table to query the schema of the table.
Query table data
You can click
that you want to query under the established MaxCompute connection, enter the SQL query for the desired table in the editor, and execute the query.If your project's schema syntax switch is not enabled, see Enable the schema feature for details. Alternatively, right-click the desired table under the established MaxCompute connection, select View Project, and navigate to the Data tab to view the data.