This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Bad practice with datasource? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Bad practice with datasource?" Watch "Bad practice with datasource?" New topic
Author

Bad practice with datasource?

Gary Seibold
Greenhorn

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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
134

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


[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
 
 
subject: Bad practice with datasource?
 
Similar Threads
Empty catch statement in JDBC code
Is it the right way?
Transaction EJB session bean
database connection in servlet
Need help on Passing parameters