This commit is contained in:
zyyang 2021-01-13 16:33:14 +08:00
parent c967956212
commit 6538d19603
2 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,7 @@ package com.taosdata.jdbc;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit;
public class TSDBStatement implements Statement { public class TSDBStatement implements Statement {
private TSDBJNIConnector connector = null; private TSDBJNIConnector connector = null;
@ -67,6 +68,12 @@ public class TSDBStatement implements Statement {
// TODO make sure it is not a update query // TODO make sure it is not a update query
pSql = this.connector.executeQuery(sql); pSql = this.connector.executeQuery(sql);
try {
TimeUnit.SECONDS.sleep(10);
} catch (InterruptedException e) {
e.printStackTrace();
}
long resultSetPointer = this.connector.getResultSet(); long resultSetPointer = this.connector.getResultSet();
if (resultSetPointer == TSDBConstants.JNI_CONNECTION_NULL) { if (resultSetPointer == TSDBConstants.JNI_CONNECTION_NULL) {

View File

@ -31,7 +31,6 @@ public class MultiThreadsWithSameStatmentTest {
Thread t1 = new Thread(() -> { Thread t1 = new Thread(() -> {
try { try {
ResultSet resultSet = stmt.executeQuery("select * from jdbctest.weather"); ResultSet resultSet = stmt.executeQuery("select * from jdbctest.weather");
sleep(5000);
while (resultSet.next()) { while (resultSet.next()) {
ResultSetMetaData metaData = resultSet.getMetaData(); ResultSetMetaData metaData = resultSet.getMetaData();
for (int i = 1; i <= metaData.getColumnCount(); i++) { for (int i = 1; i <= metaData.getColumnCount(); i++) {