• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Does ResultSet close when connection closes?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'am wondering if anybody knows if the connection closes that was used to retrieve a ResultSet, does the ResultSet also close. Can you continue to use a ResultSet after the connection that retrieved the ResultSet closes?

Thanks for any answers
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The two are different.

I like to close InitialContext, ResultSet, Statement and Connection (in that order).
 
Ranch Hand
Posts: 243
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can't use the ResultSet once the Connection that is used to create the ResultSet is closed.
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FYI Plz.

Catchd ResultSet
 
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi there...
the ResultSet implementation is very tied with the Connection object that created it. The ResultSet object exsits as long as the Connection Object does. Oneway around this is to make use of a RowSet Object. The RowSet class is an extension of the Statement class; thus it inherits all the capabilities provided in its super class. A RowSet Object caches its ResultSet and also the necessary information to re-establish the connection again. This means that they are serializable!.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The ResultSet object exsits as long as the Connection Object does.


The Connection API documentation does not support this statement. It is possible that some JDBC driver providers may implement this facility, but a developer cannot write portable code on the basis of proprietary features.

The RowSet class is an extension of the Statement class


The RowSet interface is a subinterface of ResultSet.
 
I RELEASE YOU! (for now .... ) Feel free to peruse this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic