Help Center/ Data Lake Insight/ Best Practices/ Connecting BI Tools to DLI for Data Analysis/ Configuring DBeaver to Connect to DLI for Data Query and Analysis
Updated on 2025-02-26 GMT+08:00

Configuring DBeaver to Connect to DLI for Data Query and Analysis

DBeaver is a free, open source, and visual database management tool that you can use to manage various types of databases, including viewing the database structure, executing SQL queries and scripts, and browsing and exporting data. This section describes how to configure DBeaver to connect to DLI.

Preparations

  • Toolkits
    • DLI JDBC driver:

      Download the JDBC driver huaweicloud-dli-jdbc-xxx-dependencies.jar from the DLI management console.

    • DBeaver client installation package:

      The DBeaver official website provides client installation packages for different OSs. Download the required DBeaver client installation package and install it on the local PC. DBeaver 24.0.3 is recommended.

  • Connection information:
    Table 1 Connection information

    Item

    Description

    How to Obtain

    DLI's AK/SK

    AK/SK-based authentication refers to the use of an AK/SK pair to sign requests for identity authentication.

    Obtaining an AK/SK

    DLI's endpoint address

    Endpoint of a cloud service in a region.

    Obtaining an Endpoint

    DLI's project ID

    Project ID, which is used for resource isolation.

    Obtaining a Project ID

    DLI's region information

    DLI's region information

    Regions and Endpoints

Step 1: Create a DLI JDBC Driver on DBeaver

  1. In DBeaver, choose Database > Driver Manager.

    Use the driver class to load DLI's JDBC driver. Make sure to use the JAR file huaweicloud-dli-jdbc-2.1.1-jar-with-dependencies.jar.

  2. Click New.
  3. In the displayed dialog box, set driver parameters and click OK.
    Set driver parameters based on Table 2.
    Table 2 Driver parameters

    Parameter

    Description

    Driver Name

    Enter a name that is easy to identify, for example, GaussDB Driver.

    Driver Type

    Set it to Generic.

    Class Name

    Java class name used to establish a database connection in the JDBC driver.

    URL Template

    Format of DLI's JDBC driver.

    For how to configure DLI's JDBC driver, see Format of DLI's JDBC driver and Example configuration of DLI's JDBC driver.

    jdbc:dli://<endPoint>/projectId?<key1>=<val1>;<key2>=<val2>...

    Default Port

    Port of the database to connect.

    Default Database

    Name of the database to connect.

    Default User

    Account name, which is root by default.

    • Format of DLI's JDBC driver
      jdbc:dli://<endPoint>/projectId?<key1>=<val1>;<key2>=<val2>...

      ? is followed by other configuration items, with each item listed in the "key=value" format and multiple items are separated by semicolons (;).

    • Example configuration of DLI's JDBC driver
      jdbc:dli://dli.ap-southeast-2.myhuaweicloud.com/0b33ea2a7e0010802fe4c009bb05076d?databasename=tpch;queuename=auto;accesskey=XXXX;secretkey=XXXXX;regionname=ap-southeast-2;enginetype=trino;catalog=lfcatalog

      Table 3 and Table 4 describe the parameters.

      Table 3 Driver configuration parameters

      Parameter

      Description

      How to Obtain

      endPoint

      Endpoint of a cloud service in a region.

      Obtaining an AK/SK

      projectId

      ID of the project where DLI resources are.

      Obtaining an Endpoint

      <key1>=<val1>

      ? is followed by other configuration items, with each item listed in the "key=value" format and multiple items are separated by semicolons (;).

      Table 4

      Table 4 key=value parameter description

      Parameter

      Description

      Mandatory

      Example Value

      queuename

      DLI queue name.

      Yes

      dli_test

      databasename

      Database name.

      Yes

      tpch

      accesskey and secretkey

      AK/SK that acts as the authentication key.

      Set them if authenticationmode is aksk.

      Yes

      accesskey=your-access-key

      secretkey=your-secret-key

      regionname

      Region name of DLI

      Set it if authenticationmode is aksk.

      Yes

      -

      charset

      Encoding method used by JDBC.

      The default value is UTF-8.

      No

      -

      enginetype

      DLI queue type. The options are:

      • spark: Spark queue.
      • hetuEngine: HetuEngine queue.

      The default value is spark.

      No

      spark

      catalog

      Metadata catalog name.

      • It is mandatory when a LakeFormation catalog is used. In this case, it indicates the name of the LakeFormation catalog used.

        When querying the LakeFormation catalog, there must be a default database under the catalog.

      • If left unset, a DLI catalog is used by default. You do not need to set this parameter when using the DLI catalog.

      No

      For example, if you use a LakeFormation catalog named lfcatalog, the configuration is as follows: catalog=lfcatalog.

  4. On the Libraries tab, click Add File and add dli-jdbc-xxx-dependencies.jar in 1.
  5. After the file is added, the driver class is empty. Click Find Class to set the driver class. The identified driver class must be the same as the class name specified on the Settings tab.
  6. Click OK to complete the driver settings.

Step 2: Test the Connection to the Database

  1. In the menu bar of the DBeaver client, choose Database > New Database Connection and select the data driver created in Step 1: Create a DLI JDBC Driver on DBeaver.
  2. Click Finish to connect to DLI. You can view information about the connected database in the Database Navigator view toolbar.
  3. Query data on DLI through the new connection.

Step 3: Compile SQL Queries on DBeaver

Once DBeaver is connected to DLI, you can compile SQL queries on DBeaver.

  1. Select a database object in Database Navigator on the left and write SQL statements in the SQL editor in the middle.
  2. Once a query is compiled, execute it by clicking the running button on the toolbar, which is usually represented by a green play icon.
  3. After the query is executed, the result is displayed in the data grid below the SQL editor.