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:
- Download the TDengine JDBC driver.
- In a Web browser, open the Maven Central Repository Search page.
- Search for
com.taosdata.jdbcand click the Download icon.
- Select the
dist.jarformat and save the file to your local machine.
- Download and install the DBeaver package from the official website.
- Once installation is complete, open DBeaver. From the main menu, select Database > Driver Manager and click New.
- 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.RestfulDriverin 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:
- 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.
- 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
- You can then enter
DESCRIBE log.dnodes\_info;to see the schema of the
- Finally, you can enter
SELECT LAST\_ROW(*) FROM log.dnodes\_info GROUP BY dnode\_id;to see the latest data point for each
- 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.