- JDK >= 1.8
- Maven >= 3.0
mvn clean package -Dmaven.test.skip=true
mvn clean install -Dmaven.test.skip=true
<dependencies>
<dependency>
<groupId>cn.edu.tsinghua</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>0.8.0-SNAPSHOT</version>
</dependency>
</dependencies>
(for more detailes, please see example/src/main/java/cn/edu/tsinghua/jdbcDemo/SendDataToIotdb.java)
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Example {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("cn.edu.tsinghua.iotdb.jdbc.TsfileDriver");
Connection connection = null;
Statement statement = null;
try {
connection = DriverManager.getConnection("jdbc:tsfile://127.0.0.1:6667/", "root", "root");
statement = connection.createStatement();
statement.execute("select s1 from root.laptop.d1");
ResultSet resultSet = statement.getResultSet();
while(resultSet.next()){
System.out.println(String.format("timestamp %s, value %s", resultSet.getString(1), resultSet.getString(2)));
}
} finally {
if(statement != null) statement.close();
if(connection != null) connection.close();
}
}
}