|
|
|
@ -11,7 +11,7 @@ import com.fr.license.exception.DataBaseNotSupportedException;
|
|
|
|
|
import com.fr.stable.Nameable; |
|
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
|
import com.fr.workspace.server.database.DataBaseTypeOperator; |
|
|
|
|
import com.fr.workspace.server.database.ResultBean; |
|
|
|
|
import com.fr.workspace.server.database.DatabaseResultBean; |
|
|
|
|
|
|
|
|
|
import javax.swing.JPanel; |
|
|
|
|
import java.awt.BorderLayout; |
|
|
|
@ -76,21 +76,13 @@ public class ConnectionManagerPane extends LoadingBasicPane implements Connectio
|
|
|
|
|
ListModelElement selectedValue = this.connectionListPane.getSelectedValue(); |
|
|
|
|
if (selectedValue != null) { |
|
|
|
|
Nameable wrapper = selectedValue.wrapper; |
|
|
|
|
try { |
|
|
|
|
Connection connection = (Connection) ((NameObject) wrapper).getObject(); |
|
|
|
|
// 仅校验jdbc连接,其他插件数据连接不进行校验
|
|
|
|
|
if (connection instanceof JDBCDatabaseConnection) { |
|
|
|
|
ResultBean bean = WorkContext.getCurrent().get(DataBaseTypeOperator.class).validateDatabaseType(connection.getDriver(), connection.feature()); |
|
|
|
|
if (bean != null) { |
|
|
|
|
throw new DataBaseNotSupportedException(bean.getErrorMsg()); |
|
|
|
|
} |
|
|
|
|
Connection connection = (Connection) ((NameObject) wrapper).getObject(); |
|
|
|
|
// 仅校验jdbc连接,其他插件数据连接不进行校验
|
|
|
|
|
if (connection instanceof JDBCDatabaseConnection) { |
|
|
|
|
DatabaseResultBean bean = WorkContext.getCurrent().get(DataBaseTypeOperator.class).validateDatabaseType(connection.getDriver(), connection.feature()); |
|
|
|
|
if (bean.equals(DatabaseResultBean.DefaultBean())) { |
|
|
|
|
throw new DataBaseNotSupportedException(bean.getMsg()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (DataBaseNotSupportedException e) { |
|
|
|
|
// 仅抛出数据库类型不支持异常
|
|
|
|
|
throw e; |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
// ignore
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|