aspose file tools*
The moose likes JDBC 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 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connection closed exception?" Watch "connection closed exception?" New topic
Author

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
Greenhorn

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.


SCJP 6,SCWCD 5,SCBCD 5

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?
 
Similar Threads
Try catch finally query
finally block in Exceptions
DB connection..
connection already closed problem
JDBC connection using eclipse ide