Client Libraries
TDengine provides a rich set of application development interfaces. To facilitate users in quickly developing their own applications, TDengine supports connectors for multiple programming languages, including official connectors for C/C++, Java, Python, Go, Node.js, C#, and Rust. These connectors support connecting to the TDengine cluster using the native interface (taosc) and WebSocket interface. Community developers have also contributed several unofficial connectors, such as the ADO.NET connector, Lua connector, and PHP connector.
Supported Platforms
Currently, the native interface connectors for TDengine support platforms including: X64/ARM64 hardware platforms, as well as Linux/Win64 development environments. The compatibility matrix is as follows:
CPU | OS | Java | Python | Go | Node.js | C# | Rust | C/C++ |
---|---|---|---|---|---|---|---|---|
X86 64bit | Linux | ● | ● | ● | ● | ● | ● | ● |
X86 64bit | Win64 | ● | ● | ● | ● | ● | ● | ● |
X86 64bit | macOS | ● | ● | ● | ○ | ○ | ● | ● |
ARM64 | Linux | ● | ● | ● | ● | ○ | ○ | ● |
ARM64 | macOS | ● | ● | ● | ○ | ○ | ● | ● |
Where ● indicates official testing and verification passed, ○ indicates unofficial testing and verification passed, -- indicates unverified.
Using REST connections can support a wider range of operating systems as they do not depend on client drivers.
Version Support
TDengine version updates often add new features. The list below shows the best matching connector versions for each TDengine version.
TDengine Version | Java | Python | Go | C# | Node.js | Rust | C/C++ |
---|---|---|---|---|---|---|---|
3.3.0.0 and above | 3.3.0 and above | taospy 2.7.15 and above, taos-ws-py 0.3.2 and above | 3.5.5 and above | 3.1.3 and above | 3.1.0 and above | Current version | Same as TDengine version |
3.0.0.0 and above | 3.0.2 and above | Current version | 3.0 branch | 3.0.0 | 3.1.0 | Current version | Same as TDengine version |
2.4.0.14 and above | 2.0.38 | Current version | develop branch | 1.0.2 - 1.0.6 | 2.0.10 - 2.0.12 | Current version | Same as TDengine version |
2.4.0.4 - 2.4.0.13 | 2.0.37 | Current version | develop branch | 1.0.2 - 1.0.6 | 2.0.10 - 2.0.12 | Current version | Same as TDengine version |
2.2.x.x | 2.0.36 | Current version | master branch | n/a | 2.0.7 - 2.0.9 | Current version | Same as TDengine version |
2.0.x.x | 2.0.34 | Current version | master branch | n/a | 2.0.1 - 2.0.6 | Current version | Same as TDengine version |
Feature Support
The following table compares the support for TDengine features by the connector:
Using Native Interface (taosc)
Feature | Java | Python | Go | C# | Rust | C/C++ |
---|---|---|---|---|---|---|
Connection Management | Supported | Supported | Supported | Supported | Supported | Supported |
Execute SQL | Supported | Supported | Supported | Supported | Supported | Supported |
Parameter Binding | Supported | Supported | Supported | Supported | Supported | Supported |
Data Subscription (TMQ) | Supported | Supported | Supported | Supported | Supported | Supported |
Schema-less Write | Supported | Supported | Supported | Supported | Supported | Supported |
Due to different database framework specifications in various programming languages, it does not imply that all C/C++ interfaces need corresponding encapsulation support.
Using HTTP REST Interface
Feature | Java | Python | Go |
---|---|---|---|
Connection Management | Supported | Supported | Supported |
Execute SQL | Supported | Supported | Supported |
Using WebSocket Interface
Feature | Java | Python | Go | C# | Node.js | Rust | C/C++ |
---|---|---|---|---|---|---|---|
Connection Management | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
Execute SQL | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
Parameter Binding | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
Data Subscription (TMQ) | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
Schema-less Write | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
- Regardless of the programming language connector chosen, it is recommended for database applications using TDengine version 2.0 and above to establish an independent connection for each thread, or to establish a connection pool based on threads, to avoid interference of the "USE statement" state variable among threads (however, the connection's query and write operations are thread-safe).
Install Client Driver
You only need to install the client driver if you are using a native interface connector on a system where the TDengine server software is not installed.
Installation Steps
- Linux
- Windows
- MacOS
- Download the client installation package
-
Unzip the software package
Place the package in any directory where the current user has read and write access, then execute the following command:
tar -xzvf TDengine-client-VERSION.tar.gz
Replace VERSION with the actual version string. -
Run the installation script
After unzipping the package, you will see the following files (directories) in the unzipped directory:
- install_client.sh: Installation script, used for applying the driver
- package.tar.gz: Application driver installation package
- driver: TDengine application driver
- examples: Sample programs for various programming languages (c/C#/go/JDBC/MATLAB/python/R) Run install_client.sh to install.
-
Configure taos.cfg
Edit the
taos.cfg
file (default path /etc/taos/taos.cfg), changefirstEP
to the End Point of the TDengine server, for example:h1.tdengine.com:6030
- If the TDengine service is not deployed on this machine and only the application driver is installed, then only
firstEP
needs to be configured intaos.cfg
, there is no need to configureFQDN
on this machine. - To prevent the "Unable to resolve FQDN" error when connecting to the server, it is recommended to ensure that the
/etc/hosts
file on your machine is configured with the correct FQDN value of the server, or that the DNS service is properly configured.
-
Download the client installation package
Download TDengineEnter your information to receive a download linkI agree to receive communications from TDengine and to allow TDengine to store and process my personal data. -
Run the installer, follow the prompts to select the default values, and complete the installation
-
Installation path
The default installation path is: C:\TDengine, which includes the following files (directories):
- taos.exe: TDengine CLI command line program
- taosadapter.exe: Server executable that provides RESTful services and accepts write requests from various other software
- taosBenchmark.exe: TDengine test program
- cfg: Configuration file directory
- driver: Application driver dynamic link library
- examples: Example programs for bash/C/C#/go/JDBC/Python/Node.js
- include: Header files
- log: Log files
- unins000.exe: Uninstallation program
-
Configure taos.cfg
Edit the taos.cfg file (default path C:\TDengine\cfg\taos.cfg), change firstEP to the End Point of the TDengine server, for example:
h1.tdengine.com:6030
.
- If using FQDN to connect to the server, ensure that the local network environment DNS is properly configured, or add FQDN addressing records in the hosts file, such as editing C:\Windows\system32\drivers\etc\hosts, adding records like:
192.168.1.99 h1.taos.com
- Uninstallation: Run unins000.exe to uninstall the TDengine application driver.
-
Download the client installation package
Download TDengineEnter your information to receive a download linkI agree to receive communications from TDengine and to allow TDengine to store and process my personal data. -
Run the installer and follow the prompts to select the default values to complete the installation. If the installation is blocked, you can right-click or press Ctrl and click on the installation package, then choose
Open
. -
Configure taos.cfg
Edit the
taos.cfg
file (default path /etc/taos/taos.cfg), and changefirstEP
to the End Point of the TDengine server, for example:h1.tdengine.com:6030
- If the TDengine service is not deployed on the local machine and only the application driver is installed, then only
firstEP
needs to be configured intaos.cfg
, there is no need to configureFQDN
on the local machine. - To prevent the “Unable to resolve FQDN” error when connecting to the server, it is recommended to ensure that the local
/etc/hosts
file has been configured with the correct FQDN value of the server, or that the DNS service has been properly set up.
Installation Verification
After completing the above installation and configuration, and confirming that the TDengine service has started running normally, you can now use the TDengine CLI tool to log in.
- Linux
- Windows
- MacOS
In the Linux shell, execute taos
directly to connect to the TDengine service, entering the TDengine CLI interface, as shown below:
$ taos
taos> show databases;
name |
=================================
information_schema |
performance_schema |
db |
Query OK, 3 rows in database (0.019154s)
taos>
In the cmd, navigate to the C:\TDengine directory and directly execute taos.exe
to connect to the TDengine service, entering the TDengine CLI interface. An example is shown below:
taos> show databases;
name | create_time | vgroups | ntables | replica | strict | duration | keep | buffer | pagesize | pages | minrows | maxrows | comp | precision | status | retention | single_stable | cachemodel | cachesize | wal_level | wal_fsync_period | wal_retention_period | wal_retention_size |
===============================================================================================================================================================================================================================================================================================================================================================================================================================
information_schema | NULL | NULL | 14 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
performance_schema | NULL | NULL | 3 | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL | ready | NULL | NULL | NULL | NULL | NULL | NULL | NULL | NULL |
test | 2022-08-04 16:46:40.506 | 2 | 0 | 1 | off | 14400m | 5256000m,5256000m,5256000m | 96 | 4 | 256 | 100 | 4096 | 2 | ms | ready | NULL | false | none | 1 | 1 | 3000 | 0 | 0 | 0 | 0 |
Query OK, 3 rows in database (0.123000s)
taos>
In the macOS shell, execute taos
directly to connect to the TDengine service, entering the TDengine CLI interface, as shown below:
$ taos
taos> show databases;
name |
=================================
information_schema |
performance_schema |
db |
Query OK, 3 rows in database (0.019154s)
taos>
📄️ C/C++
C/C++ developers can use the TDengine client driver, i.e., the C/C++ connector (hereinafter referred to as the TDengine client driver), to develop their own applications to connect to the TDengine cluster for data storage, querying, and other functionalities. The API of the TDengine client driver is similar to MySQL's C API. When using the application, it is necessary to include the TDengine header file, which lists the function prototypes of the provided APIs; the application also needs to link to the corresponding dynamic library on the platform.
📄️ Java
taos-jdbcdriver is the official Java connector for TDengine, allowing Java developers to develop applications that access the TDengine database. taos-jdbcdriver implements the interfaces of the JDBC driver standard.
📄️ Go
driver-go is the official Go language connector for TDengine, implementing the interface of the Go language database/sql package. Go developers can use it to develop applications that access data in the TDengine cluster.
📄️ Rust
Crates.io Crates.io docs.rs
📄️ Python
taospy is the official Python connector for TDengine. taospy provides a rich API, making it convenient for Python applications to use TDengine.
📄️ Node.js
@tdengine/websocket is the official Node.js language connector for TDengine. Node.js developers can use it to develop applications that access the TDengine database.
📄️ C#
TDengine.Connector is the C# language connector provided by TDengine. C# developers can use it to develop C# applications that access data in the TDengine cluster.
📄️ R
The RJDBC library in R language can enable R language programs to access TDengine data. Here are the installation process, configuration process, and R language example code.
📄️ PHP
php-tdengine is a PHP connector extension contributed by the community, which also specifically supports Swoole coroutine.
📄️ ODBC
TDengine ODBC is an ODBC driver implemented for TDengine, supporting applications on Windows systems (such as PowerBI and others) as well as user-customized applications to access TDengine databases locally, remotely, and via cloud services through the ODBC standard interface.
📄️ REST API
To support development on various types of platforms, TDengine offers an API that adheres to RESTful design standards, namely the REST API. To minimize the learning curve, unlike other databases' REST API design methods, TDengine operates the database directly through SQL statements contained in the BODY of an HTTP POST request, requiring only one URL.