Browse Source

REPORT-134268 【FBP】连接本地数据库测试连接成功 使用时连接错误

fbp/release
Destiny.Lin 2 months ago
parent
commit
5a16283f67
  1. 3
      designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java
  2. 10
      designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java
  3. 3
      designer-base/src/main/java/com/fr/design/data/datapane/preview/TableDataBeanHelper.java

3
designer-base/src/main/java/com/fr/design/actions/server/GlobalTableDataAction.java

@ -87,14 +87,11 @@ public class GlobalTableDataAction extends UpdateAction implements ResponseDataS
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll());
final Map<String, TableData> tableDataMap = new HashMap<>();
try {
TransmissionEncryptionManager.setTransEncryptionLevel(1);
for (ServerDataSetBean bean : beans) {
tableDataMap.put(bean.getDatasetName() , TableDataBeanHelper.getTableDataSet(connectionMap, bean.getDatasetType(), bean.getDatasetData()));
}
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
final TableDataManagerPane globalTableDataPane = new TableDataManagerPane() {

10
designer-base/src/main/java/com/fr/design/data/datapane/connect/LocalConnectionSource.java

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

3
designer-base/src/main/java/com/fr/design/data/datapane/preview/TableDataBeanHelper.java

@ -52,14 +52,11 @@ public class TableDataBeanHelper {
final Map<String, Connection> connectionMap = ConnectionInfoBeanHelper.createConnectionMap(ConnectionRepository.getInstance().getAll());
final Map<String, TableData> tableDataMap = new HashMap<>();
try {
TransmissionEncryptionManager.setTransEncryptionLevel(1);
for (ServerDataSetBean bean : beans) {
tableDataMap.put(bean.getDatasetName() , TableDataBeanHelper.getTableDataSet(connectionMap, bean.getDatasetType(), bean.getDatasetData()));
}
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
TransmissionEncryptionManager.removeTransEncryptionLevel();
}
return tableDataMap;
}

Loading…
Cancel
Save