提交 2dd06a33 编写于 作者: J jurgen

Driver config error dialog

上级 da3886ef
......@@ -38,7 +38,6 @@ import org.jkiss.dbeaver.model.struct.*;
import org.jkiss.dbeaver.model.struct.rdb.*;
import org.jkiss.dbeaver.registry.DataSourceProviderRegistry;
import org.jkiss.dbeaver.registry.DataTypeProviderDescriptor;
import org.jkiss.dbeaver.runtime.RuntimeUtils;
import org.jkiss.dbeaver.runtime.VoidProgressMonitor;
import org.jkiss.dbeaver.ui.DBIcon;
import org.jkiss.dbeaver.ui.UIUtils;
......@@ -1204,17 +1203,13 @@ public final class DBUtils {
DBPDataSource dataSource = error.getDataSource();
if (dataSource instanceof DBPErrorAssistant) {
DBPErrorAssistant.ErrorType errorType = ((DBPErrorAssistant) dataSource).discoverErrorType(error);
if (errorType == DBPErrorAssistant.ErrorType.CONNECTION_LOST) {
DataSourceInvalidateHandler.showConnectionLostDialog(shell, message, error);
return true;
}
}
if (dataSource != null && error instanceof DBCConnectException) {
Throwable rootCause = RuntimeUtils.getRootCause(error);
if (rootCause instanceof ClassNotFoundException) {
// Looks like bad driver configuration
DriverEditDialog.showBadConfigDialog(shell, message, error);
return true;
switch (errorType) {
case CONNECTION_LOST:
DataSourceInvalidateHandler.showConnectionLostDialog(shell, message, error);
return true;
case DRIVER_CLASS_MISSING:
DriverEditDialog.showBadConfigDialog(shell, message, error);
return true;
}
}
......
......@@ -39,6 +39,7 @@ import org.jkiss.dbeaver.model.struct.DBSDataType;
import org.jkiss.dbeaver.model.struct.DBSObject;
import org.jkiss.dbeaver.model.struct.DBSObjectContainer;
import org.jkiss.dbeaver.runtime.RuntimeUtils;
import org.jkiss.dbeaver.ui.dialogs.driver.DriverEditDialog;
import org.jkiss.utils.CommonUtils;
import java.sql.*;
......@@ -478,6 +479,14 @@ public abstract class JDBCDataSource
{
return ErrorType.CONNECTION_LOST;
}
if (error instanceof DBCConnectException) {
Throwable rootCause = RuntimeUtils.getRootCause(error);
if (rootCause instanceof ClassNotFoundException) {
// Looks like bad driver configuration
return ErrorType.DRIVER_CLASS_MISSING;
}
}
return ErrorType.NORMAL;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册