如何获取 JavaPreparedStatement.executeQuery(..) 的状态
我有一个使用这样的东西运行的 SQL 查询:
PreparedStatement pstmt = dbConn.prepareStatement(sqlQuery);
ResultSet rs = null;
..
.. Set parms here ..
..
rs = pstmt.executeQuery();
当我使用本地数据库时它工作正常,但我必须在这个远程数据库上进行测试,因为它有更多的数据。 但由于地处偏远,所以需要很长时间。
我很好奇是否有办法获取状态或在一定时间后查询了多少行。 只是为了能够看到这些东西实际上在工作,我没有浪费时间看像素。 你知道,类似“好吧,到目前为止我们有 300 行,再获取 400 行”。 这样的东西存在吗?
I have a SQL query running using something like this:
PreparedStatement pstmt = dbConn.prepareStatement(sqlQuery);
ResultSet rs = null;
..
.. Set parms here ..
..
rs = pstmt.executeQuery();
It works fine when I use a local database, but I have to test on this remote one since it has a lot more data. But since it's remote, it is taking forever.
I was curious if there was a way to get the status or how many rows had been queried after a certain time. Just to be able to see that stuff was actually working and I wasn't wasting my time watching pixels. You know, something like 'Ok so far we got 300 rows, getting another 400'. Does something like that even exist?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现这是不可能的,至少以任何简单的方式都是不可能的。 我发现我可能应该拆分查询,而不是一次获得数十万个结果,而只获得 50 或 100 个结果。
I figured out that this wasn't possible, at least in any easy way. I found that that I should probably split up the query instead and not get hundreds of thousands of results at a time, but rather just 50 or a hundred.