>Can i use resultset object after the connection and statement objects are closed? No.
If you close a statement it closes all its child result sets. If you close a connection it closes all its child statements (and thus the result sets)
However good code should not rely on this. You should explicitly close all of your result sets, statements and connections (in that order)
Sahil Sharma
Ranch Hand
Joined: Aug 27, 2003
Posts: 152
posted
0
when do we get Too Many Connections exception ?. When connection objects are not closed ? Do we also get this error when dont close resultsets objects explicitly ?
This sounds like something that would be useful for you to solve yourself:
1. Write a loop that opens lots of connections. To keep them from being garbage collected, put them in an array or Collection.
2. Write a loop that: opens a connection, creates a statement and executes a simple query, like SELECT * FROM sometable, and stores the ResultSet in an array or Collection. Then close the Connection.
This sounds like a bug. I'd look for connections being continually opened without old ones being closed. My own personal style is that once I open a connection, I keep it open as long as possible, until I'm done using it, then explicitlyi close it.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus