forked from alibaba/druid
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/alibaba/druid
- Loading branch information
Showing
2 changed files
with
60 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
src/main/java/com/alibaba/druid/pool/vendor/DB2ExceptionSorter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 1999-2011 Alibaba Group Holding Ltd. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.alibaba.druid.pool.vendor; | ||
|
||
import java.sql.SQLException; | ||
import java.util.Properties; | ||
|
||
import com.alibaba.druid.pool.ExceptionSorter; | ||
|
||
public class DB2ExceptionSorter implements ExceptionSorter { | ||
|
||
@Override | ||
public boolean isExceptionFatal(SQLException e) { | ||
String sqlState = e.getSQLState(); | ||
if (sqlState != null && sqlState.startsWith("08")) { // Connection Exception | ||
return true; | ||
} | ||
|
||
int errorCode = e.getErrorCode(); | ||
switch (errorCode) { | ||
case -512: // STATEMENT REFERENCE TO REMOTE OBJECT IS INVALID | ||
case -514: // THE CURSOR IS NOT IN A PREPARED STATE | ||
case -516: // THE DESCRIBE STATEMENT DOES NOT SPECIFY A PREPARED STATEMENT | ||
case -518: // THE EXECUTE STATEMENT DOES NOT IDENTIFY A VALID PREPARED STATEMENT | ||
case -525: // THE SQL STATEMENT CANNOT BE EXECUTED BECAUSE IT WAS IN ERROR AT BIND TIME FOR SECTION = sectno | ||
// PACKAGE = pkgname CONSISTENCY TOKEN = contoken | ||
case -909: // THE OBJECT HAS BEEN DELETED OR ALTERED | ||
case -918: // THE SQL STATEMENT CANNOT BE EXECUTED BECAUSE A CONNECTION HAS BEEN LOST | ||
case -924: // DB2 CONNECTION INTERNAL ERROR, function-code,return-code,reason-code | ||
return true; | ||
default: | ||
break; | ||
} | ||
return false; | ||
} | ||
|
||
@Override | ||
public void configFromProperties(Properties properties) { | ||
|
||
} | ||
|
||
} |