Why am I getting ResultSet is closed error when I never closed any

你。 提交于 2019-12-08 11:19:50

问题


I have this error in my code and have checked and edited it thoroughly, yet I still get same issue. I also use multiple resultSet and Statements yet same error occurs. Below is the error I get:

    "Database Connected with Current Date 20130221
    java.sql.SQLException: ResultSet is closed
    at sun.jdbc.odbc.JdbcOdbcResultSet.checkOpen(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcResultSet.next(Unknown Source)
    at UNSUB.main(UNSUB.java:78)"
Press any key to continue . . .

Please What could be the reason? I have no idea on any solution now.


回答1:


The exception, java.sql.SQLException: ResultSet is closed means that your code has either already closed the result set object you're using, or more likely, that your code has either re-executed or closed the statement that produced the result set. By JDBC specs, either of those actions will close any result set from the statement.




回答2:


Have you called the method next() on the ResultSet?? If you haven't that might be the reason for you to get that error.



来源:https://stackoverflow.com/questions/14999582/why-am-i-getting-resultset-is-closed-error-when-i-never-closed-any

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!