Configuring DBeaver to Connect to DLI for Data Query and Analysis
DBeaver is a free and open-source database management tool that supports multiple databases. With DBeaver as a visual database management tool, you can view database structures, execute SQL queries and scripts, browse data, and export data. This section describes the steps for connecting DBeaver to connect to DLI.
Preparations
- Toolkit
- 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.
- DLI JDBC driver:
- Connection information:
Table 1 Connection information Item
Description
How to Obtain
DLI's AK/SK
AK/SK-based authentication uses an AK/SK pair to sign requests for identity authentication.
DLI endpoint address
Endpoint of a cloud service in a region.
DLI project ID
Project ID used for resource isolation.
DLI region information
Region to which DLI belongs.
Step 1: Create a DLI JDBC Driver in DBeaver
- In DBeaver, choose Database > Driver Manager to create a driver connection.
Use the driver class to load the DLI JDBC driver. Ensure that the JAR file used is huaweicloud-dli-jdbc-2.1.1-jar-with-dependencies.jar.
- Click New.
- In the dialog box that appears, set driver parameters and click OK. Set driver parameters based on Table 2.
Table 2 Driver parameters Parameter
Description
Driver Name
Use an identifiable name, for example, GaussDB Driver.
Driver Type
Select Generic as the driver type.
Class Name
Java class name used in the JDBC driver to establish database connections.
URL Template
DLI JDBC connection format.
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
Database port to connect to.
Default Database
Database name to connect to.
Default User
Account name, which is root by default.
- DLI JDBC connection format
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 (;).
- DLI JDBC driver connection example
jdbc:dli://dli.ap-southeast-2.myhuaweicloud.com/0b33ea2a7e0010802fe4c009bb05076d?databasename=tpch;queuename=auto;accesskey=XXXX;secretkey=XXXXX;regionname=ap-southeast-2;enginetype=spark;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.
projectId
Project ID where DLI resources are located.
<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 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 credentials.
Required when authenticationmode is aksk.
Yes
accesskey=your-access-key
secretkey=your-secret-key
regionname
DLI region name.
Required when authenticationmode is aksk.
Yes
-
charset
JDBC encoding.
The default value is UTF-8.
No
-
enginetype
DLI queue type. Options:
spark: Spark engine queue.
The default value is spark.
No
spark
catalog
Metadata catalog name.
No
For example, if using a LakeFormation catalog named lfcatalog, the configuration is as follows: catalog=lfcatalog.
- DLI JDBC connection format
- On the Libraries tab, click Add File and add dli-jdbc-xxx-dependencies.jar in 1.
- After the file is added, the driver class is empty. Click Find Class to set the driver class. The identified driver class must match the class name specified on the Settings tab.
- Click OK to complete the driver settings.
Step 2: Test the Database Connection
- 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 in DBeaver.
- Click Finish to connect to DLI. You can view the connected database information in the Database Navigator pane.
- Use the new connection to perform subsequent DLI data query operations.
Step 3: Write SQL Queries in DBeaver
After establishing a DLI connection in DBeaver, you can write SQL queries in DBeaver:
- In the database navigation pane on the left, select a database object in Database Navigator. Then, write SQL statements in the SQL editor in the center.
- After writing the query, click the run button on the toolbar (usually a green play icon) to execute it.
- After execution, results are displayed in the data grid below the SQL editor.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot