mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
添加ExceptionSorter
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@315 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -51,6 +51,7 @@ public class OracleValidConnectionChecker implements ValidConnectionChecker, Ser
|
||||
|
||||
public boolean isValidConnection(Connection c) {
|
||||
try {
|
||||
// unwrap
|
||||
Connection conn = (Connection) c.unwrap(clazz);
|
||||
if (conn != null) {
|
||||
c = conn;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.alibaba.druid.pool.vendor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import com.alibaba.druid.pool.ExceptionSorter;
|
||||
|
||||
public class SybaseExceptionSorter implements ExceptionSorter, Serializable {
|
||||
|
||||
private static final long serialVersionUID = 2742592563671255116L;
|
||||
|
||||
public boolean isExceptionFatal(SQLException e) {
|
||||
boolean result = false;
|
||||
|
||||
String errorText = (e.getMessage()).toUpperCase();
|
||||
|
||||
if ((errorText.indexOf("JZ0C0") > -1) || // ERR_CONNECTION_DEAD
|
||||
(errorText.indexOf("JZ0C1") > -1) // ERR_IOE_KILLED_CONNECTION
|
||||
) {
|
||||
result = true;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user