From b9b7bd89f7e2fd3c6f58c51c050a2dc2975517aa Mon Sep 17 00:00:00 2001 From: "Destiny.Lin" Date: Mon, 9 Sep 2024 12:24:48 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-133863=20=E3=80=90fr-fbp=E5=9B=9E?= =?UTF-8?q?=E5=BD=92=E3=80=91=E6=95=B0=E6=8D=AE=E5=AD=97=E5=85=B8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E6=8D=AE=E5=BA=93=E5=AD=97=E6=AE=B5=E7=A9=BA?= =?UTF-8?q?=E7=99=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/present/dict/DatabaseDictPane.java | 7 +++++-- .../java/com/fanruan/data/ConnectionConfigWrapper.java | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java b/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java index 5c157a7cd9..2c1f46a4a1 100644 --- a/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java +++ b/designer-base/src/main/java/com/fr/design/present/dict/DatabaseDictPane.java @@ -6,6 +6,7 @@ import com.fr.base.TableData; import com.fr.data.core.DataCoreUtils; import com.fr.data.core.db.DBUtils; import com.fr.data.core.db.dialect.Dialect; +import com.fr.data.impl.Connection; import com.fr.data.impl.DatabaseDictionary; import com.fr.data.impl.NameDatabaseConnection; import com.fr.design.beans.FurtherBasicBeanPane; @@ -25,6 +26,7 @@ import com.fr.design.event.UIObserverListener; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.ilable.UILabel; import com.fr.stable.StringUtils; +import com.fr.workspace.server.repository.connection.ConnectionRepository; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -176,8 +178,9 @@ public class DatabaseDictPane extends FurtherBasicBeanPane i if (StringUtils.isBlank(para.getDatabaseName())) { dbDict.setDatabaseConnection(null); } else { - database = DBUtils.checkDBConnection(para.getDatabaseName()); - if (database != null) { + Connection connection = ConnectionRepository.getInstance().getByName(para.getDatabaseName()).getConnection(); + if (connection != null) { + database = new NameDatabaseConnection(para.getDatabaseName()); dbDict.setDatabaseConnection(database); } } diff --git a/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java b/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java index 8c4a9e7b6b..8dd3ea86e5 100644 --- a/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java +++ b/designer-realize/src/main/java/com/fanruan/data/ConnectionConfigWrapper.java @@ -7,6 +7,8 @@ import com.fr.file.ConnectionConfig; import com.fr.log.FineLoggerFactory; import com.fr.transaction.Configurations; import com.fr.transaction.WorkerAdaptor; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.repository.connection.ConnectionRepository; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -106,7 +108,7 @@ public class ConnectionConfigWrapper implements ConnectionConfigProvider, Connec @Override public @Nullable Connection getConnection(@NotNull String connectionName) { - Connection connection = ConnectionConfig.getInstance().getConnection(connectionName); + Connection connection = WorkContext.getCurrent().isLocal() ? ConnectionConfig.getInstance().getConnection(connectionName) : ConnectionRepository.getInstance().getByName(connectionName).getConnection(); if (connection != null) { connection.setConnectionName(connectionName); }