diff --git a/src/client/src/TSDBJNIConnector.c b/src/client/src/TSDBJNIConnector.c index 8c3e4a69828f7f1e1ecd9b66d99f38ea74f8fac5..6fa1ed9da1f48d11619eb778748e10ad18b190d7 100644 --- a/src/client/src/TSDBJNIConnector.c +++ b/src/client/src/TSDBJNIConnector.c @@ -407,8 +407,14 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_fetchRowImp(JNIEn TAOS_ROW row = taos_fetch_row(result); if (row == NULL) { - jniTrace("jobj:%p, taos:%p, resultset:%p, fields size is %d, fetch row to the end", jobj, tscon, res, num_fields); - return JNI_FETCH_END; + int tserrno = taos_errno(tscon); + if (tserrno == 0) { + jniTrace("jobj:%p, taos:%p, resultset:%p, fields size is %d, fetch row to the end", jobj, tscon, res, num_fields); + return JNI_FETCH_END; + } else { + jniTrace("jobj:%p, taos:%p, interruptted query", jobj, tscon); + return JNI_RESULT_SET_NULL; + } } char tmp[TSDB_MAX_BYTES_PER_ROW] = {0}; @@ -649,4 +655,4 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_validateCreateTab JNIEXPORT jstring JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_getTsCharset(JNIEnv *env, jobject jobj) { return (*env)->NewStringUTF(env, (const char *)tsCharset); -} \ No newline at end of file +}