• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Statement closed upon connection close()?

 
Jean-Michel Vilain
Greenhorn
Posts: 27
Chrome IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I open a connection via a connection pool, then create a statement on that connection.
When I close the connection, is the statement closed automatically?
Maybe it's obvious but I really need to make sure.
Particularly in the case of a connection pool, because close() doesn't really close the connection (if my pool understanding is correct).
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Properly implemented connection pool should close the statements and resultsets when you return the connection to the pool. Otherwise another request could obtain a connection which has statements/resultsets open, and that certainly isn't desired.

A poorly implemented connection pool might neglect some of these finesses, but I'd expect all mainstream connection pools to be much more robust. Most importantly - it should be fairly easy to test with the connection pool you're using.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic