This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes connection closed exception? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "connection closed exception?" Watch "connection closed exception?" New topic

connection closed exception?

santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Dear all

When we call another method i get connetion has been closed exception .even though im creating new Connection in the second method

If i replace the code in finally block with this

It will work with out exception
so kindly help me in this issue

Creativity is nothing but Breaking Rules
Chitti Ruddarraju

Joined: Oct 19, 2009
Posts: 7
Can you explain elaborately..
Siva Masilamani
Ranch Hand

Joined: Sep 19, 2008
Posts: 385
You are getting this exception because you are trying to close the statement in the closed connection.

So the correct order is

close the statement and then the connection.


Failure is not an option.
santhosh.R gowda
Ranch Hand

Joined: Apr 06, 2009
Posts: 296
Thanks now i got it....
I agree. Here's the link:
subject: connection closed exception?
jQuery in Action, 3rd edition