This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JDBC and the fly likes what if we do not close DB connection ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "what if we do not close DB connection ?" Watch "what if we do not close DB connection ?" New topic
Author

what if we do not close DB connection ?

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, good day, wondering if we didn't close the DB Connection, what would happen ? thank you !
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29287
    
140

Alvin,
If we don't close a DB connection, we get something called a "connection leak." This drains resources from the system. If you are using a connection pool, it can also prevent you from obtaining a connection later on.


[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
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thanks, Jeanne Boyarsky
David Blaine
Ranch Hand

Joined: Mar 23, 2013
Posts: 70
Jeanne Boyarsky wrote:Alvin,
If we don't close a DB connection, we get something called a "connection leak." This drains resources from the system. If you are using a connection pool, it can also prevent you from obtaining a connection later on.

What is this connection leak, what exactly is drained and how is it drained ?

thanks
deepak veyan
Greenhorn

Joined: May 02, 2012
Posts: 10

Hi,

From my observations , the server would simply stop giving out new connections once the threshold is reached.This could lead into an over head situation for the application server administrator.You may have to forcefully close connections through the application server(might require restart mostly).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what if we do not close DB connection ?
 
Similar Threads
ResultSet needs connection?
Connection pool - running out of connections
Why we want close connection ?.
JDBC object closing
memory leackage