Using DBeaver in your TDengine deployment

DBeaver is a popular open-source tool used for database management and as an SQL client. This article explains how to use DBeaver with a TDengine time-series database (TSDB).

In this article, DBeaver 22.1.2 is used to connect with TDengine 2.6 using the TDengine REST API.

Configuring DBeaver for TDengine

To install and configure DBeaver, perform the following steps:

  1. Download the TDengine JDBC driver.
    1. In a Web browser, open the Maven Central Repository Search page.
    2. Search for com.taosdata.jdbc and click the Download icon.
    3. Select the dist.jar format and save the file to your local machine.
  2. Download and install the DBeaver package from the official website.
  3. Once installation is complete, open DBeaver. From the main menu, select Database > Driver Manager and click New.
  1. In the Create new driver window, open the Libraries tab and click Add file. Select the JAR file that you downloaded in Step 1 and click Open.
  • At the bottom of the window, click Find Class. Then, select com.taosdata.jdbc.rs.RestfulDriver in the Driver class field.
  • Open the Settings tab and enter a name for the driver. Then enter the URL template, port, database, and user for your TDengine deployment. The format for the URL template is as follows: jdbc:TAOS-RS://<host-name>:<port>/<database_name>?user=<user>&password=<password>
  • Select Database > New Database Connection, open the All tab, and search for the driver that you created. Click Next.
  • Enter the URL for your TDengine deployment and click Test Connection.

Verification

  • Once the connection is successful, your TDengine database is displayed in the Database Navigator window. You can click on tables within the database to show the schema and data contained in each table.
  • From the main menu, select SQL Editor > Open SQL Console and enter SQL statements to verify that the connection is working properly. Note: RESTful requests are stateless. For this reason, you must include the database name in queries and writes.
  • As an example, you can enter SHOW log.stables; to display all supertables in the default log database.
  • You can then enter DESCRIBE log.dnodes\_info; to see the schema of the dnodes\_info supertable.
  • Finally, you can enter SELECT LAST\_ROW(*) FROM log.dnodes\_info GROUP BY dnode\_id; to see the latest data point for each dnode\_id.
  • You can also use DBeaver to write data to your TDengine databases.

If the preceding statements executed successfully, this indicated that the connection between DBeaver and TDengine is working properly. With DBeaver, you can use a variety of features, including SQL scripts, with your TDengine deployment.

If you have any difficulties in using TDengine or recommendations for improvement, get in touch with us on GitHub or Discord.