From 37aa0504aa97e1407d80141860828c4f68ee3c40 Mon Sep 17 00:00:00 2001 From: gemini Date: Wed, 12 Aug 2020 16:02:25 +0800 Subject: [PATCH] fix TD-1115 --- .../main/java/com/taosdata/jdbc/TSDBStatement.java | 2 +- .../jdbc/src/test/java/TestAsyncTSDBSubscribe.java | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java index 1cf024f30e..777eef53d1 100644 --- a/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java +++ b/src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBStatement.java @@ -158,9 +158,9 @@ public class TSDBStatement implements Statement { throw new SQLException(TSDBConstants.FixErrMsg(TSDBConstants.JNI_CONNECTION_NULL)); } else if (resultSetPointer == TSDBConstants.JNI_NULL_POINTER) { // no result set is retrieved + this.connecter.freeResultSet(pSql); res = false; } - this.connecter.freeResultSet(pSql); return res; } diff --git a/src/connector/jdbc/src/test/java/TestAsyncTSDBSubscribe.java b/src/connector/jdbc/src/test/java/TestAsyncTSDBSubscribe.java index 03a4761b91..6d4c6b1e94 100644 --- a/src/connector/jdbc/src/test/java/TestAsyncTSDBSubscribe.java +++ b/src/connector/jdbc/src/test/java/TestAsyncTSDBSubscribe.java @@ -42,12 +42,14 @@ public class TestAsyncTSDBSubscribe { long subscribId = 0; try { Class.forName("com.taosdata.jdbc.TSDBDriver"); + Properties properties = new Properties(); - properties.setProperty(TSDBDriver.PROPERTY_KEY_HOST, host); - properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); - properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); - properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); - properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); + properties.setProperty(TSDBDriver.PROPERTY_KEY_HOST, host); + properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); + properties.setProperty(TSDBDriver.PROPERTY_KEY_CHARSET, "UTF-8"); + properties.setProperty(TSDBDriver.PROPERTY_KEY_LOCALE, "en_US.UTF-8"); + properties.setProperty(TSDBDriver.PROPERTY_KEY_TIME_ZONE, "UTC-8"); + connection = DriverManager.getConnection("jdbc:TAOS://" + host + ":0/" + dbName + "?user=root&password=taosdata", properties); String rawSql = "select * from " + tName + ";"; TSDBSubscribe subscribe = ((TSDBConnection) connection).createSubscribe(); -- GitLab