Bug #5070 'Operation not allowed after ResultSet closed' with PreparedStatement
Submitted: 17 Aug 2004 3:48 Modified: 17 Aug 2004 4:05
Reporter: Ken Johanson Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version:3.1.3-beta OS:
Assigned to: Mark Matthews CPU Architecture:Any

[17 Aug 2004 3:48] Ken Johanson
Description:
Getting a:

java.sql.SQLException: Operation not allowed after ResultSet closed
	at com.mysql.jdbc.ResultSet.checkClosed(ResultSet.java:4631)
	at com.mysql.jdbc.ResultSet.last(ResultSet.java:2381)

How to repeat:
PreparedStatement ps = con.prepareStatement(query);
//ps.setObject(i+1, args[i]);
ResultSet rs = ps.executeQuery();
ResultSetMetaData md = rs.getMetaData();
colLen = md.getColumnCount();
rs.last(); <--cause
[17 Aug 2004 4:05] Mark Matthews
I can't repeat this given your code example.

Are you sure that something somewhere (your connection pool, for example) isn't executing another query on the given statement? _Something_ is closing that result set, either it's explicitly closed, or it's being closed by the fact that the statement has either had another query executed on it, or the statement itself has been closed, either explicitly or by the Connection that created it being closed.
[17 Aug 2004 5:07] Ken Johanson
Right you are, it was being closed in a try-finally, on this bug and the first tonight relating to PreparedStatement. My Aplogies, and thank you. Case closed.