Skip to content

Commit 0f01892

Browse files
committed
Merge pull request #542 from SmiNatalia/patch-1
Bad connection issue if autoCommit = false
2 parents dca09fb + dcfa458 commit 0f01892

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/java/org/apache/ibatis/datasource/pooled/PooledDataSource.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,11 @@ private PooledConnection popConnection(String username, String password) throws
397397
state.accumulatedCheckoutTime += longestCheckoutTime;
398398
state.activeConnections.remove(oldestActiveConnection);
399399
if (!oldestActiveConnection.getRealConnection().getAutoCommit()) {
400-
oldestActiveConnection.getRealConnection().rollback();
400+
try {
401+
oldestActiveConnection.getRealConnection().rollback();
402+
} catch (SQLException e) {
403+
log.debug("Bad connection. Could not roll back");
404+
}
401405
}
402406
conn = new PooledConnection(oldestActiveConnection.getRealConnection(), this);
403407
oldestActiveConnection.invalidate();

0 commit comments

Comments
 (0)