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, 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 of MaxCompute JDBC driver V3.2.8 or later is downloaded. This package includes the
jar-with-dependencies
package.MaxCompute JDBC driver V3.2.9 is used in this topic.
DBeaver is downloaded and installed.
For more information about how to install DBeaver, see Install.
DBeaver Community Edition 21.1.3 is used in this topic.
Step 1: Connect DBeaver to MaxCompute
Start DBeaver.
In the main menu bar, click the icon. In the Select your database dialog box, choose and 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.2.9-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.
On the Main tab of the Generic JDBC Connection Settings dialog box, enter a Uniform Resource Locator (URL) that is used to connect to the MaxCompute project in the Path field.
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. If the message shown in the following figure appears, click OK and Finish.
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 right-click the table that you want to query under the established MaxCompute connection and select View Table. On the tab that appears, click the Data tab to query the data of the table.