How to use the Apache IoTDB client interface
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