This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Closing connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Closing connection" Watch "Closing connection" New topic

Closing connection

david allen
Ranch Hand

Joined: Sep 27, 2002
Posts: 185
What happens if you do not close the connection to the database?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Depends on the database provider, but most of the time, the connection times out and get's closed automatically. Of course, if you are using connection pooling, there should always be open connections anyway.
Depending on the provider and your app, it isn't a huge deal if a connection doesn't get closed. But I have seen it cause some locking problems.

GenRocket - Experts at Building Test Data
I agree. Here's the link:
subject: Closing connection
It's not a secret anymore!