It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes Bad practice with datasource? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Bad practice with datasource?" Watch "Bad practice with datasource?" New topic

Bad practice with datasource?

Gary Seibold

Joined: Oct 08, 2004
Posts: 7
Is this a bad practice when using datasources? I am thinking of connection pooling and wondering if there is a connection left open.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
You need to close your connections, too.

James Carman, President<br />Carman Consulting, Inc.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Also, you should close the statement and connection in a finally block.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Bad practice with datasource?
It's not a secret anymore!