• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jdbc statement  RSS feed

 
mamidi venkat
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i would like to know that suppose we got the connection object and created the statement object also
and we have closed the connection but we havn't close the statement object it automatically close the statement
or we need to close the statement explicitly

i heard that statement object will close automatically when we close the connection is it true ?

prasad
 
Scott Selikoff
author
Bartender
Posts: 4085
21
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once the connection is closed, the statement cannot be used and is closed. But, its a good practice to explicitly close ResultSets, Statements, and Connections as part of finally blocks. Please refer to my blog post on the subject for more information. At the very least, it can help with garbage collection to close objects as soon as you are done with them.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!