Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to use the Apache IoTDB client interface

Shulou Source: shulou.com Published: 2022-06-01 04:42:48 10月14日 Update

This article mainly explains "how to use the Apache IoTDB client interface". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor learn how to use the Apache IoTDB client interface.

JDBC interface

JDBC is not only the standard interface of relational database, but also the most familiar interface. So we provided this interface from the very beginning.

In the same way as standard JDBC, you need to load database driver classes, establish connections, establish Statement, and execute statements through Statement. For non-queries, batch execution can reduce the number of network transmissions. Here is a simple example

Public static void main (String [] args) throws ClassNotFoundException, SQLException {Class.forName ("org.apache.iotdb.jdbc.IoTDBDriver"); try (Connection connection = DriverManager .getConnection ("jdbc:iotdb://127.0.0.1:6667/", "root", "root"); Statement statement = connection.createStatement () {/ / create storage group statement.execute ("SET STORAGE GROUP TO root.sg1") / / create time series statement.execute ("CREATE TIMESERIES root.sg1.d1.s1 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute ("CREATE TIMESERIES root.sg1.d1.s2 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); statement.execute ("CREATE TIMESERIES root.sg1.d1.s3 WITH DATATYPE=INT64, ENCODING=RLE, COMPRESSOR=SNAPPY"); / / accumulate a batch of update statements for (int I = 0; I) on the client side

Tags: Interface data type client client time query multiple method test point structure result statement original content sequence database array mode standard Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Apple Docker Shulou Technology NVidia