Skip to main content

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.

Figure 1. TDengine client library architecture

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:

CPUOSJavaPythonGoNode.jsC#RustC/C++
X86 64bitLinux
X86 64bitWin64
X86 64bitmacOS
ARM64Linux
ARM64macOS

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 VersionJavaPythonGoC#Node.jsRustC/C++
3.3.0.0 and above3.3.0+taospy 2.7.15+, taos-ws-py 0.3.2+3.5.5+3.1.3+3.1.0+LatestSame as TDengine
3.0.0.0 and above3.0.2+Latest3.0 branch3.0.03.1.0LatestSame as TDengine
2.4.0.14 and above2.0.38Latestdevelop branch1.0.2 - 1.0.62.0.10 - 2.0.12LatestSame as TDengine
2.4.0.4 - 2.4.0.132.0.37Latestdevelop branch1.0.2 - 1.0.62.0.10 - 2.0.12LatestSame as TDengine
2.2.x.x2.0.36Latestmaster branchn/a2.0.7 - 2.0.9LatestSame as TDengine
2.0.x.x2.0.34Latestmaster branchn/a2.0.1 - 2.0.6LatestSame as TDengine

Feature Support

The following tables show the feature support for TDengine connectors.

Using Native Interface (taosc)

FeatureJavaPythonGoC#RustC/C++
Connection ManagementSupportedSupportedSupportedSupportedSupportedSupported
Execute SQLSupportedSupportedSupportedSupportedSupportedSupported
Parameter BindingSupportedSupportedSupportedSupportedSupportedSupported
Data Subscription (TMQ)SupportedSupportedSupportedSupportedSupportedSupported
Schemaless WriteSupportedSupportedSupportedSupportedSupportedSupported
info

Different programming languages follow their own database framework standards, so not all C/C++ interfaces require corresponding wrappers.

Using HTTP REST Interface

FeatureJavaPythonGo
Connection ManagementSupportedSupportedSupported
Execute SQLSupportedSupportedSupported

Using WebSocket Interface

FeatureJavaPythonGoC#Node.jsRustC/C++
Connection ManagementSupportedSupportedSupportedSupportedSupportedSupportedSupported
Execute SQLSupportedSupportedSupportedSupportedSupportedSupportedSupported
Parameter BindingSupportedSupportedSupportedSupportedSupportedSupportedSupported
Data Subscription (TMQ)SupportedSupportedSupportedSupportedSupportedSupportedSupported
Schemaless WriteSupportedSupportedSupportedSupportedSupportedSupportedSupported
warning

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

info

Client drivers are only required when using native interface connectors on systems without TDengine server software installed.

Installation Steps

  1. Download the client installation package
    1. 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 Replace VERSION with the actual version string.

    2. 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.
    3. Configure taos.cfg

      Edit the taos.cfg file (default path: /etc/taos/taos.cfg) and change firstEP to the TDengine server's End Point, for example: h1.tdengine.com:6030

    tip
    1. If TDengine service is not deployed on this machine and only the application driver is installed, you only need to configure firstEP in taos.cfg, and there is no need to configure FQDN on this machine.
    2. 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.

    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>

    📄️ 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.