wood burning stoves 2.0
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
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: http://aspose.com/file-tools
subject: connection closed exception?
It's not a secret anymore!