You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2020/02/21 16:59:50 UTC

[incubator-iotdb] branch version_compatibility updated: print better message if users use new client to connect iotdb 0.9.

This is an automated email from the ASF dual-hosted git repository.

hxd pushed a commit to branch version_compatibility
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/version_compatibility by this push:
     new a08fab3  print better message if users use new client to connect iotdb 0.9.
a08fab3 is described below

commit a08fab3353c56bf529bbc493a1e51bfd6ff6770a
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Sat Feb 22 00:59:28 2020 +0800

    print better message if users use new client to connect iotdb 0.9.
---
 jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java
index 691d53f..4afaf45 100644
--- a/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java
+++ b/jdbc/src/main/java/org/apache/iotdb/jdbc/IoTDBConnection.java
@@ -440,7 +440,13 @@ public class IoTDBConnection implements Connection {
 
     } catch (TException e) {
       transport.close();
-      throw new SQLException(String.format("Can not establish connection with %s : %s",
+      if (e.getMessage().contains("Required field 'client_protocol' was not present!")) {
+        // the server is an old version (less than 0.10)
+        throw new SQLException(String.format(
+            "Can not establish connection with %s : You may try to connect an old version IoTDB instance using a client with new version: %s. ",
+            params.getJdbcUriString(), e.getMessage()), e);
+      }
+      throw new SQLException(String.format("Can not establish connection with %s : %s. ",
           params.getJdbcUriString(), e.getMessage()), e);
     } catch (IoTDBRPCException e) {
       // failed to connect, disconnect from the server