Bug #10127 Operation now allowed on closed ResultSet
Submitted: 24 Apr 2005 14:47 Modified: 31 Mar 2014 9:19
Reporter: Srinivas Somayajula Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / J Severity:S2 (Serious)
Version: OS:Any
Assigned to: Alexander Soklakov CPU Architecture:Any

[24 Apr 2005 14:47] Srinivas Somayajula
Description:
After executing the following piece of code, i am getting the "Operation Not Allowed on closed ResultSet", SQL Exception.  I noticed someone else reporting a similar bug but his problem was in the code.  I am doing the following steps:

1.  Create null ResultSet(rs) and Statement(stmt)
2.  Obtain a connection from a connection pool.
3.  Excute my query.
4.  Operation Now Allowed on closed ResultSet appears.

I am working on a JSP web application.  This occurs when I am trying to validate  user inputted fields on a form using a "request" scoped bean.  I set all the properties and execute a "validate()" method which tries to connect to the db and what not.  Here is the code it breaks at.  Thanks for your help. 

Environment:  
Tomcat 5.1
MySQL 4.0.24 

How to repeat:
	private void populateZipList(String city) {
		Connection conn = null;
		ResultSet rs = null;
		Statement stmt = null;
		
		try {
			conn = DatabaseUtil.getConnection();
			stmt = conn.createStatement();
						
			rs = stmt.executeQuery("SELECT ZIP_CODE FROM ZIP_CODE_DATA WHERE CITY = '" + city + "'");
			
			
			while (rs.next()) {
				validZipCodes.add(rs.getString("ZIP_CODE"));
			}
			
		} catch (SQLException sqlex) {			
		}
		
	}
[27 Apr 2005 17:18] Mark Matthews
Something is closing the connection out from underneath you, which in turn closes the statement, which in turn closes the result set (as is required by the JDBC spec).

Are you using a connection pool? Sharing connections? Is there anything in your MySQL server's error log about killing a connection?
[27 May 2005 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[31 Mar 2014 9:19] Alexander Soklakov
I close this report as "Can't repeat" because there is no feedback for a long time and codebase is too old. Please, feel free to reopen it if the problem still exists in current driver.