Hi, When you saw this message, it means your server is v0.9.0-SNAPSHOT, while the JDBC is v0.8.0. Upgrading the JDBC version will solve the problem.
Best, ----------------------------------- Xiangdong Huang School of Software, Tsinghua University 黄向东 清华大学 软件学院 邢质坦 (Jira) <[email protected]> 于2019年8月29日周四 下午3:39写道: > 邢质坦 created IOTDB-186: > ------------------------- > > Summary: I encountered an exception when I connect to IoTDB > by iotdb jdbc driver > Key: IOTDB-186 > URL: https://issues.apache.org/jira/browse/IOTDB-186 > Project: Apache IoTDB > Issue Type: Bug > Reporter: 邢质坦 > > > Exception Messge: > LF4J: Class path contains multiple SLF4J bindings. > SLF4J: Found binding in > [jar:file:/D:/Program%20Files/Apache/maven-repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class] > SLF4J: Found binding in > [jar:file:/D:/Program%20Files/Apache/maven-repository/org/slf4j/slf4j-log4j12/1.7.16/slf4j-log4j12-1.7.16.jar!/org/slf4j/impl/StaticLoggerBinder.class] > SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an > explanation. > SLF4J: Actual binding is of type > [ch.qos.logback.classic.util.ContextSelectorStaticBinder] > Exception in thread "main" java.sql.SQLException: Can not establish > connection with jdbc:iotdb://10.12.20.122:6667/. > at > org.apache.iotdb.jdbc.IoTDBConnection.openSession(IoTDBConnection.java:444) > at > org.apache.iotdb.jdbc.IoTDBConnection.<init>(IoTDBConnection.java:93) > at org.apache.iotdb.jdbc.IoTDBDriver.connect(IoTDBDriver.java:63) > at java.sql.DriverManager.getConnection(DriverManager.java:664) > at java.sql.DriverManager.getConnection(DriverManager.java:247) > at cn.edu.thu.collect.IoTDBDirectly.connect(IoTDBDirectly.java:31) > at cn.edu.thu.init.InitStorageGroup.main(InitStorageGroup.java:28) > Caused by: org.apache.thrift.protocol.TProtocolException: Required field > 'statusType' was not present! Struct: TS_Status(statusType:null) > at > org.apache.iotdb.service.rpc.thrift.TS_Status.validate(TS_Status.java:477) > at > org.apache.iotdb.service.rpc.thrift.TS_Status$TS_StatusStandardScheme.read(TS_Status.java:562) > at > org.apache.iotdb.service.rpc.thrift.TS_Status$TS_StatusStandardScheme.read(TS_Status.java:507) > at > org.apache.iotdb.service.rpc.thrift.TS_Status.read(TS_Status.java:431) > at > org.apache.iotdb.service.rpc.thrift.TSOpenSessionResp$TSOpenSessionRespStandardScheme.read(TSOpenSessionResp.java:626) > at > org.apache.iotdb.service.rpc.thrift.TSOpenSessionResp$TSOpenSessionRespStandardScheme.read(TSOpenSessionResp.java:611) > at > org.apache.iotdb.service.rpc.thrift.TSOpenSessionResp.read(TSOpenSessionResp.java:521) > at > org.apache.iotdb.service.rpc.thrift.TSIService$openSession_result$openSession_resultStandardScheme.read(TSIService.java:3151) > at > org.apache.iotdb.service.rpc.thrift.TSIService$openSession_result$openSession_resultStandardScheme.read(TSIService.java:3136) > at > org.apache.iotdb.service.rpc.thrift.TSIService$openSession_result.read(TSIService.java:3083) > at > org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:86) > at > org.apache.iotdb.service.rpc.thrift.TSIService$Client.recv_openSession(TSIService.java:156) > at > org.apache.iotdb.service.rpc.thrift.TSIService$Client.openSession(TSIService.java:143) > at > org.apache.iotdb.jdbc.IoTDBConnection.openSession(IoTDBConnection.java:419) > ... 6 more > > Process finished with exit code 1 > > > > My Java Class: > > package com.json.to.insert.web.test.demo; > > import java.sql.*; > import java.text.SimpleDateFormat; > > /** > * @author xingzhitan > * @date 2019/8/29 15:20 > */ > public class IoTDBHelloWorld { > > public static void main(String[] args) throws ClassNotFoundException, > SQLException { > Connection connection = null; > Statement statement = null; > try { > > // 1. load JDBC driver of IoTDB > Class.forName("org.apache.iotdb.jdbc.IoTDBDriver"); > // 2. DriverManager connect to IoTDB > connection = DriverManager.getConnection("jdbc:iotdb:// > 10.12.20.122:6667/", "root", "root"); > // 3. Create statement > statement = connection.createStatement(); > // 4. Set storage group > statement.execute("set storage group to root.vehicle.sensor"); > // 5. Create timeseries > statement.execute("CREATE TIMESERIES > root.vehicle.sensor.sensor0 WITH DATATYPE=DOUBLE, ENCODING=PLAIN"); > // 6. Insert data to IoTDB > statement.execute("INSERT INTO root.vehicle.sensor(timestamp, > sensor0) VALUES (2018/10/24 19:33:00, 142)"); > // 7. Query data > String sql = "select * from root.vehicle.sensor"; > String path = "root.vehicle.sensor.sensor0"; > boolean hasResultSet = statement.execute(sql); > SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd > HH:mm:ss.SSS"); > if (hasResultSet) { > ResultSet res = statement.getResultSet(); > System.out.println(" Time" + "|" + > path); > while (res.next()) { > long time = Long.parseLong(res.getString("Time")); > String dateTime = dateFormat.format(new Date(time)); > System.out.println(dateTime + " | " + > res.getString(path)); > } > res.close(); > } > } > finally { > // 8. Close > if (statement != null) statement.close(); > if (connection != null) connection.close(); > } > } > > > } > > > > > > > > > -- > This message was sent by Atlassian Jira > (v8.3.2#803003) >
