Client Libraries
TDengine provides a rich set of application development interfaces. To help users quickly develop their applications, TDengine supports connectors for multiple programming languages. Official connectors include those for C/C++, Java, Python, Go, Node.js, C#, and Rust. These connectors support both native interfaces (taosc) and WebSocket interfaces to connect to the TDengine cluster. Community developers have also contributed several unofficial connectors, such as ADO.NET, Lua, and PHP connectors.
Supported Platforms
Currently, TDengine's native interface connectors support the following platforms: X64/ARM64 hardware and 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 | ● | ● | ● | ○ | ○ | ● | ● |
Here, ● indicates official testing and verification, ○ indicates unofficial testing and verification, and -- means untested.
Using the REST connection, which does not depend on client drivers, enables support for a broader range of operating systems.
Version Support
TDengine updates often introduce new features. The connector versions listed correspond to the optimal versions for each TDengine release.
TDengine Version | Java | Python | Go | C# | Node.js | Rust | C/C++ |
---|---|---|---|---|---|---|---|
3.3.0.0 and above | 3.3.0+ | taospy 2.7.15+, taos-ws-py 0.3.2+ | 3.5.5+ | 3.1.3+ | 3.1.0+ | Latest | Same as TDengine |
3.0.0.0 and above | 3.0.2+ | Latest | 3.0 branch | 3.0.0 | 3.1.0 | Latest | Same as TDengine |
2.4.0.14 and above | 2.0.38 | Latest | develop branch | 1.0.2 - 1.0.6 | 2.0.10 - 2.0.12 | Latest | Same as TDengine |
2.4.0.4 - 2.4.0.13 | 2.0.37 | Latest | develop branch | 1.0.2 - 1.0.6 | 2.0.10 - 2.0.12 | Latest | Same as TDengine |
2.2.x.x | 2.0.36 | Latest | master branch | n/a | 2.0.7 - 2.0.9 | Latest | Same as TDengine |
2.0.x.x | 2.0.34 | Latest | master branch | n/a | 2.0.1 - 2.0.6 | Latest | Same as TDengine |
Feature Support
The following tables show the feature support for TDengine connectors.
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 |
Schemaless Write | Supported | Supported | Supported | Supported | Supported | Supported |
Different programming languages follow their own database framework standards, so not all C/C++ interfaces require corresponding wrappers.
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 |
Schemaless Write | Supported | Supported | Supported | Supported | Supported | Supported | Supported |
For TDengine version 2.0 and above, it is recommended that each thread in the application establish its own connection or use a connection pool based on threads to avoid interference between thread states caused by the "USE statement." However, query and write operations on connections are thread-safe.
Installing Client Drivers
Client drivers are only required when using native interface connectors on systems without TDengine server software installed.
Installation Steps
- Linux
- Windows
- MacOS
- Download the client installation package
-
Extract the software package
Place the package in any directory where the current user has read and write permissions, then execute the following command:
tar -xzvf TDengine-client-VERSION.tar.gz
ReplaceVERSION
with the actual version string. -
Execute the installation script
After extracting the package, you will see the following files (directories) in the extraction directory:
- install_client.sh: The installation script for the application driver
- package.tar.gz: The application driver installation package
- driver: The TDengine application driver
- examples: Example programs in various programming languages (C/C#/Go/JDBC/MATLAB/Python/R)
Run
install_client.sh
to perform the installation.
-
Configure
taos.cfg
Edit the
taos.cfg
file (default path:/etc/taos/taos.cfg
) and changefirstEP
to the TDengine server's End Point, for example:h1.tdengine.com:6030
- If TDengine service is not deployed on this machine and only the application driver is installed, you only need to configure
firstEP
intaos.cfg
, and there is no need to configureFQDN
on this machine. - To prevent the error "Unable to resolve FQDN" when connecting to the server, it is recommended to ensure that the
/etc/hosts
file on this machine has been configured with the correct FQDN value for the server or that DNS services have been 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, choose the default options as prompted, 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 file providing RESTful services and accepting write requests from various other software
- taosBenchmark.exe: TDengine testing program
- cfg: Configuration file directory
- driver: Application driver dynamic link library
- examples: Example programs in bash/C/C#/go/JDBC/Python/Node.js
- include: Header files
- log: Log files
- unins000.exe: Uninstaller
-
Configure
taos.cfg
Edit the
taos.cfg
file (default pathC:\TDengine\cfg\taos.cfg
) and changefirstEP
to the TDengine server's endpoint, for example:h1.tdengine.com:6030
.
- If connecting to the server using FQDN, ensure that the local network environment's DNS is configured, or add an FQDN addressing record in the hosts file, such as editing
C:\Windows\system32\drivers\etc\hosts
to add a record like:192.168.1.99 h1.taos.com
. - Uninstall: 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 installation program and follow the prompts to choose the default values to complete the installation. If the installation is blocked, you can right-click or press Ctrl while clicking the installation package and select
Open
. -
Configure
taos.cfg
Edit the
taos.cfg
file (default path:/etc/taos/taos.cfg
) and changefirstEP
to the TDengine server's End Point, for example:h1.tdengine.com:6030
- If TDengine service is not deployed on this machine and only the application driver is installed, you only need to configure
firstEP
intaos.cfg
, and there is no need to configureFQDN
on this machine. - To prevent the error "Unable to resolve FQDN" when connecting to the server, it is recommended to ensure that the
/etc/hosts
file on this machine has been configured with the correct FQDN value for the server or that DNS services have been properly configured.
Installation Verification
After completing the installation and configuration, and ensuring the TDengine service is running properly, you can log in using the TDengine CLI tool.
- Linux
- Windows
- MacOS
In the Linux shell, you can directly execute taos
to connect to the TDengine service and enter the TDengine CLI interface. Here is an example:
$ 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 execute taos.exe
to connect to the TDengine service, entering the TDengine CLI interface. Here is an example:
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, you can directly execute taos
to connect to the TDengine service and enter the TDengine CLI interface. Here is an example:
$ 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 TDengine's client driver, the C/C++ connector (hereafter referred to as the TDengine client driver), to develop their own applications that connect to the TDengine cluster for data storage, querying, and other functions. The API of the TDengine client driver is similar to MySQL's C API. When using the application, you need to include the TDengine header file, which lists the function prototypes of the provided API; the application must also link to the corresponding dynamic library on its platform.
📄️ Java
The TDengine Java Connector is implemented based on the standard JDBC API and provides both native and REST connection options.
📄️ Go
driver-go is the official Go language connector for TDengine, implementing the interface of Go's database/sql package. Go developers can use it to develop applications that access data from TDengine clusters.
📄️ Rust
Crates.io Crates.io docs.rs
📄️ Python
taospy is the official Python connector for TDengine. taospy provides a rich set of APIs that allow Python applications to easily use TDengine.
📄️ Node.js
@tdengine/websocket is the official Node.js connector for TDengine. Node.js developers can use it to develop applications that access TDengine databases.
📄️ C#
TDengine.Connector is the C# connector provided by TDengine, allowing C# developers to create applications that access TDengine cluster data.
📄️ R
By using the RJDBC library in R, R programs can access data from TDengine. Below are the installation process, configuration steps, and R code examples.
📄️ 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, allowing applications on Windows systems (such as PowerBI) to access tables/views in the TDengine database through the ODBC standard interface, whether they are local, remote, or cloud-based.
📄️ REST API
Detailed introduction to the RESTful API provided by TDengine.