'Why does resultSet.next() hang when using streaming query
JDBC connection hangs at executing rs.next()
I found the answer here, but it doesn't work in my code;
My query will return 12150 rows of data;
When select * is used, only 12125 rows of data are returned;
When select task_log_id is used, 11457 rows are returned and all data is returned after waiting some time (it is not clear how long);
Does anyone know why
SqlSession sqlSession = sqlSessionFactory.openSession();
Connection connection = sqlSession.getConnection();
PreparedStatement statement = connection.prepareStatement("select task_log_id from s_msg_task_log where send_time <= '2021-07-13'", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
statement.setFetchSize(Integer.MIN_VALUE);
ResultSet resultset = statement.executeQuery();
int i = 0;
while (resultset.next()) {
i++;
System.out.println("i=" + i);
if (i == 12125) {
Thread.sleep(3000);
System.out.println("sleep ok");
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
