|
|
@ -52,26 +52,19 @@ public class LocalConnectionSource extends BaseConnectionSource { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public String[] testConnection(ConnectionInfoBean database) throws Exception { |
|
|
|
public String[] testConnection(ConnectionInfoBean database) throws Exception { |
|
|
|
try { |
|
|
|
try { |
|
|
|
// 暂时这么处理,后续最好拉到外层包装一下
|
|
|
|
|
|
|
|
TransmissionEncryptionManager.setTransEncryptionLevel(1); |
|
|
|
|
|
|
|
return ConnectionProcessorFactory.testConnectionWithSchemaReturn(database); |
|
|
|
return ConnectionProcessorFactory.testConnectionWithSchemaReturn(database); |
|
|
|
} catch (DriverNotFoundException e) { |
|
|
|
} catch (DriverNotFoundException e) { |
|
|
|
throw new DriverUnExistException(); |
|
|
|
throw new DriverUnExistException(); |
|
|
|
} finally { |
|
|
|
|
|
|
|
TransmissionEncryptionManager.removeTransEncryptionLevel(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void add(ConnectionInfoBean bean) throws Exception { |
|
|
|
public void add(ConnectionInfoBean bean) throws Exception { |
|
|
|
try { |
|
|
|
try { |
|
|
|
TransmissionEncryptionManager.setTransEncryptionLevel(1); |
|
|
|
|
|
|
|
Connection connection = ConnectionProcessorFactory.createConnection(bean); |
|
|
|
Connection connection = ConnectionProcessorFactory.createConnection(bean); |
|
|
|
validate(bean.getConnectionName(), connection); |
|
|
|
validate(bean.getConnectionName(), connection); |
|
|
|
ConnectionProcessorFactory.addConnection(bean); |
|
|
|
ConnectionProcessorFactory.addConnection(bean); |
|
|
|
} catch (DriverNotFoundException e) { |
|
|
|
} catch (DriverNotFoundException e) { |
|
|
|
throw new DriverUnExistException(); |
|
|
|
throw new DriverUnExistException(); |
|
|
|
} finally { |
|
|
|
|
|
|
|
TransmissionEncryptionManager.removeTransEncryptionLevel(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -84,14 +77,11 @@ public class LocalConnectionSource extends BaseConnectionSource { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void update(ConnectionInfoBean bean) throws Exception { |
|
|
|
public void update(ConnectionInfoBean bean) throws Exception { |
|
|
|
try { |
|
|
|
try { |
|
|
|
TransmissionEncryptionManager.setTransEncryptionLevel(1); |
|
|
|
|
|
|
|
Connection connection = ConnectionProcessorFactory.createConnection(bean); |
|
|
|
Connection connection = ConnectionProcessorFactory.createConnection(bean); |
|
|
|
validate(bean.getConnectionName(), connection); |
|
|
|
validate(bean.getConnectionName(), connection); |
|
|
|
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean); |
|
|
|
ConnectionProcessorFactory.updateConnection(bean.getConnectionName(), bean); |
|
|
|
} catch (DriverNotFoundException e) { |
|
|
|
} catch (DriverNotFoundException e) { |
|
|
|
throw new DriverUnExistException(); |
|
|
|
throw new DriverUnExistException(); |
|
|
|
} finally { |
|
|
|
|
|
|
|
TransmissionEncryptionManager.removeTransEncryptionLevel(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|