MySQL Forums
Forum List  »  Connector/JDBC and Java

Re: java.net.SocketException: Software caused connection abort: recv failed
Posted by: Armin Ulbrich
Date: February 09, 2007 04:47AM

Hello all!
For all of you who have not solved this problem by now, I would like to propose a 'solution' or at least some workaround from code I am using (see below).
Hope it helps!
armin_

try {

statement_ = connection_.createStatement();
res = statement_.executeQuery(selectStatement); // in this line the trouble sets in in case of a time-out!

} catch (SQLException ex) {

try {

connection_.close();
Class.forName( Drivername );
Properties info = new Properties();
info.setProperty("user", User);
info.setProperty("password", Password);
connection_ = DriverManager.getConnection(DatabaseUrl, info);

// Now retry executing the query. If it was a time-out, this time it should work

statement_ = connection_.createStatement();
res = statement_.executeQuery(selectStatement);

} catch (SQLException secondEx) {
// this was not a time-out -- do some error handling
}
}

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.