Subject | ResultSet closing |
---|---|
Author | nrajagopal35 |
Post date | 2003-12-05T04:55:20Z |
Dear Team,
Does any one knows why JayBird throws "java.sql.SQLException: The
resultSet is closed", when the ResultSet is already closed.
According to specifications, if you close the statement then the
ResultSet also is closed.
In our code to make sure the closing of ResultSet and Statement, we
will close the ResultSet after closing Statement. In some cases to
ensure the closing, the same were closed in finally block for the
second time.
In these situations, SQLException is thrown with resultSet is closed.
Say in a block of code we are closing statement and again closing the
ResultSet in the try block. We catch SQLException and assume that
there is some problem in executing the query and do rollback. In these
cases SQLException thrown for ResultSet closed will be a problem.
So instead of throwing an SQLException just we will simply return
without throwing any Exception or at the
most we can log the message. Because SQLException can be thrown only
when some real problem occurs.
Kindly update me if anyone knows the reason behind this.
Thanks & Regards,
Rajagopal N
Does any one knows why JayBird throws "java.sql.SQLException: The
resultSet is closed", when the ResultSet is already closed.
According to specifications, if you close the statement then the
ResultSet also is closed.
In our code to make sure the closing of ResultSet and Statement, we
will close the ResultSet after closing Statement. In some cases to
ensure the closing, the same were closed in finally block for the
second time.
In these situations, SQLException is thrown with resultSet is closed.
Say in a block of code we are closing statement and again closing the
ResultSet in the try block. We catch SQLException and assume that
there is some problem in executing the query and do rollback. In these
cases SQLException thrown for ResultSet closed will be a problem.
So instead of throwing an SQLException just we will simply return
without throwing any Exception or at the
most we can log the message. Because SQLException can be thrown only
when some real problem occurs.
Kindly update me if anyone knows the reason behind this.
Thanks & Regards,
Rajagopal N