File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

closing connections

 
binu sukumar
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When we close a connection (connectionobject.close()),
will the statements and resultsets automatically get closed..?
Or, do we have to close statements and resultsets explicitly..?
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, they will all close too, since they depend on the connection. It's advisable to close your statement & resultset separately though.
------------------
Bosun
SCJP for the Java� 2 Platform
 
Stanley Tan
Ranch Hand
Posts: 243
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also believe there's a way to use disconnected ResultSets such that if the connection is closed the ResultSet can still be used. Am I right?
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The resultse is a pointer to a row(s) that match the criteria. You will need to put your rows in some kind of collection such an ArrayList, if you want to access it when the connection is closed. There could be another way that I am not aware of.
------------------
Bosun
SCJP for the Java� 2 Platform
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stanley:
I think you are referring to a CachedRowSet?
 
Stanley Tan
Ranch Hand
Posts: 243
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bingo! That's it!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic