The moose likes JDBC and the fly likes statement N connection Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "statement N connection" Watch "statement N connection" New topic
Author

statement N connection

eswar kumar
Ranch Hand

Joined: Oct 20, 2002
Posts: 98
what happens if forgot to close both connection and statement ?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26138
    
  66

That could slow down your future db connections until the connections are reclaimed.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Daniel Moore
Ranch Hand

Joined: Dec 12, 2003
Posts: 31
Databases have a limited number of connections available. When you close a JDBC connection, you tell the driver to release the database connection. If you don't, you may run out of database connections. What happens after that is implementation dependent, but generally not good.


<a href="http://www.mooreds.com/weblog/" target="_blank" rel="nofollow">http://www.mooreds.com/weblog/</a>
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: statement N connection
 
Similar Threads
consuquences of not closing ResultSet?
Statement Reuse?
Iimplemenatation classes of Connection,Statement,PrepareStatement,CallabaleStatement?
Exception : ResultSet is closed
PreparedStatement closes prematurely while in Websphere 5.0