Skip to content

Commit

Permalink
discard mysql streaming resultSet close error connection
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Apr 20, 2016
1 parent e035705 commit cfc464b
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ public boolean isExceptionFatal(SQLException e) {

String message = e.getMessage();
if (message != null && message.length() > 0) {
if (message.startsWith("Streaming result set com.mysql.jdbc.RowDataDynamic")
&& message.endsWith("is still active. No statements may be issued when any streaming result sets are open and in use on a given connection. Ensure that you have called .close() on any active streaming result sets before attempting more queries.")) {
return true;
}

final String errorText = message.toUpperCase();

if ((errorCode == 0 && (errorText.contains("COMMUNICATIONS LINK FAILURE")) //
Expand All @@ -78,15 +83,6 @@ public boolean isExceptionFatal(SQLException e) {
}
}

StackTraceElement[] stackTrace = e.getStackTrace();
for (int i = 0; i < stackTrace.length; ++i) {
StackTraceElement element = stackTrace[i];
if ("com.mysql.jdbc.RowDataDynamic".equals(element.getClassName()) //
&& "close".equals(element.getMethodName())
) {
return true;
}
}

return false;
}
Expand Down

0 comments on commit cfc464b

Please sign in to comment.