All Products
Search
Document Center

MaxCompute:Connect DataGrip to MaxCompute

Last Updated:Feb 11, 2025

MaxCompute supports DataGrip, a database management tool. This topic walks you through how to connect the MaxCompute JDBC driver to DataGrip, so you can use it to manage your data.

Background information

DataGrip is a comprehensive database management tool for developers, offering a convenient way to query, create, and manage databases on a local machine, through a server, or in the cloud. For more information, see DataGrip.

Prerequisites

  • A MaxCompute project has been created.

    For more information on creating a MaxCompute project, see Create a MaxCompute project.

  • The AccessKey ID and AccessKey Secret for the MaxCompute project have been retrieved.

    These can be found on the AccessKey page.

  • The JAR package with complete dependencies, jar-with-dependencies, has been downloaded.

    You can download it directly by clicking odps-jdbc-3.9.0.jar, or retrieve the latest version of the MaxCompute JDBC driver from GitHub or the Maven repository. The version used in this example is 3.9.0.

  • DataGrip has been installed from JetBrains.

    For installation instructions, see Install DataGrip.

    The version of DataGrip used in this example is 2024.3.3.

Procedure

Follow these steps to connect DataGrip to MaxCompute:

  1. Step 1: Add a driver and configure a data source

    Upload the MaxCompute JDBC driver package to DataGrip, allowing it to access the MaxCompute project. Configure the connection parameters to establish a connection to the MaxCompute project.

  2. Step 2: Manage the MaxCompute project with DataGrip

    Once connected, manage the MaxCompute project by using DataGrip based on the established data connection.

Step 1: Add a driver and configure a data source

  1. Launch DataGrip and access the main interface.

  2. Click Main Menuimage, choose File > New > Project.

    z1

  3. In the New Project dialog box, enter a project name, for example, MaxCompute_test.

    z2

  4. In the New Project window, click Newimage > Driver.

    z3

  5. On the Data Sources and Drivers page, select the Drivers tab, click the icon image to create a User Driver, and enter a driver name, such as MaxCompute.

  6. In the Driver Files section, click the icon image > Custom JAR. Choose the downloaded MaxCompute JDBC driver JAR file from your computer, such as odps-jdbc-3.9.0-rc4-jar-with-dependencies.jar.

    z7

    Parameter

    Description

    Name

    The name of the driver that you want to add, such as MaxCompute.

    Class

    After you upload the MaxCompute JDBC driver JAR package, select com.aliyun.odps.jdbc.OdpsDriver from the drop-down list.

  7. Go to the Data Sources tab, click the icon image, and select the newly added driver, such as MaxCompute.

  8. On the General tab, fill in the required information.

    Parameter

    Description

    Name

    The default value is the same as the driver name. You can also customize it.

    Authentication

    Select User & Password.

    User

    The AccessKey ID that is used to access the MaxCompute project.

    You can obtain it on the AccessKey page.

    Password

    The AccessKey secret that corresponds to the AccessKey ID.

    You can obtain it on the AccessKey page.

    URL

    The URL that is used to connect to the MaxCompute project. The format is jdbc:odps:<MaxCompute_endpoint>?project=<MaxCompute_project_name>[&interactiveMode={true|false}]. Remove the <> symbols when configuring. The following table describes the parameters specified in the preceding statement:

    • <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. Log on to the MaxCompute console, select the region where your MaxCompute project resides in the top navigation bar, and choose Workspace > Projects. Then you can view the name of the MaxCompute project.

    • 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.

    • useProjectTimeZone: Optional. Specifies whether to use the time zone of the project. If you need DataGrip to keep the same time zone as the MaxCompute server-side instance, append &useProjectTimeZone=true to the URL.

  9. Click Test Connection to verify that the data source configuration is successful.

    z6

  10. Click OK to finalize the configuration.

Step 2: Use DataGrip to manage the MaxCompute project

Once DataGrip is connected to MaxCompute, the connection will appear in the left-side panel. You can write and execute SQL scripts to manage the MaxCompute project. For additional operations, see DataGrip Help.

  • Query all existing tables

    You can view information on all tables listed under the MaxCompute connection.

    z8

  • Query a table schema

    Right-click a table under the MaxCompute connection, choose New > Query Console, and use the SQL editor to write and run queries for the table schema.

    z9

  • Query table data

    Right-click the a table under the MaxCompute connection, choose New > Query Console, and use the SQL editor to write and run queries for table data.

    z10