• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jdbc statement

 
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
Saloon Keeper
Posts: 4031
18
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic