提交 8d25f1ca 编写于 作者: S Serge Rider

Recover connection on auto-commit/txn il checks


Former-commit-id: f883fc10
上级 5275051e
......@@ -32,6 +32,7 @@ import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.utils.RuntimeUtils;
import org.jkiss.utils.CommonUtils;
import java.lang.reflect.InvocationTargetException;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
......@@ -264,10 +265,16 @@ public class JDBCExecutionContext extends AbstractExecutionContext<JDBCDataSourc
if (transactionIsolationLevel == null) {
if (!RuntimeUtils.runTask(monitor -> {
try {
transactionIsolationLevel = getConnection().getTransactionIsolation();
} catch (Throwable e) {
transactionIsolationLevel = Connection.TRANSACTION_NONE;
log.error("Error getting transaction isolation level", e);
DBExecUtils.tryExecuteRecover(monitor, getDataSource(), monitor1 -> {
try {
transactionIsolationLevel = getConnection().getTransactionIsolation();
} catch (Throwable e) {
transactionIsolationLevel = Connection.TRANSACTION_NONE;
log.error("Error getting transaction isolation level", e);
}
});
} catch (DBException e) {
throw new InvocationTargetException(e);
}
}, "Get transaction isolation level", TXN_INFO_READ_TIMEOUT)) {
throw new DBCException("Can't determine transaction isolation - timeout");
......@@ -306,9 +313,15 @@ public class JDBCExecutionContext extends AbstractExecutionContext<JDBCDataSourc
// Run in task with timeout
if (!RuntimeUtils.runTask(monitor -> {
try {
autoCommit = getConnection().getAutoCommit();
} catch (Exception e) {
log.error("Error getting auto commit state", e);
DBExecUtils.tryExecuteRecover(monitor, getDataSource(), monitor1 -> {
try {
autoCommit = getConnection().getAutoCommit();
} catch (Exception e) {
log.error("Error getting auto commit state", e);
}
});
} catch (DBException e) {
throw new InvocationTargetException(e);
}
}, "Get auto commit state", TXN_INFO_READ_TIMEOUT)) {
throw new DBCException("Can't determine auto-commit state - timeout");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册