File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

closing connection and statement

 
eswar kumar
Ranch Hand
Posts: 98
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what will happen if i closed a connection without closing a statement?will it affect next time when i am retriving data from data base ?
 
Bosun Bello
Ranch Hand
Posts: 1510
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Closing a connection will close the statement, since the statement depends on it. It's good practice to explicitly close the statement though.
 
Dana Hanna
Ranch Hand
Posts: 227
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is expecially good practice when using connection pooling (calling connection.close() doesn't really close the connection). You can't be sure that the connection pool implementer is keeping track of your statements and closing them for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic