Jdbc connection implementation for IoTDB
Branch: master
Clone or download
liuruiyiyang and qiaojialin v0.7.1 (#80)
* change version

* update import
Latest commit badd5b3 Dec 18, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example v0.7.1 (#80) Dec 18, 2018
interface code comment and new ut (#67) Oct 25, 2018
src v0.7.1 (#80) Dec 18, 2018
.gitignore upgrade to 0.3.1 (#39) Dec 8, 2017
.travis.yml code comment and new ut (#67) Oct 25, 2018
LICENSE Initial commit Aug 21, 2017
README.md v0.7.1 (#80) Dec 18, 2018
package.sh upgrade to 0.3.1 (#39) Dec 8, 2017
pom.xml v0.7.1 (#80) Dec 18, 2018

README.md

Status

Build Status codecov Maven Central GitHub release License

Usage

Dependencies

  • JDK >= 1.8
  • Maven >= 3.0

How to package

mvn clean package -Dmaven.test.skip=true

How to install in local maven repository

mvn clean install -Dmaven.test.skip=true

Using IoTDB JDBC with Maven

<dependencies>
    <dependency>
      <groupId>cn.edu.tsinghua</groupId>
      <artifactId>iotdb-jdbc</artifactId>
      <version>0.7.1</version>
    </dependency>
</dependencies>

Example

(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();
        }
    }
}