diff --git a/base/src/org/compiere/db/CConnectionEditor.java b/base/src/org/compiere/db/CConnectionEditor.java index 6ca2a03e92..a1f107b396 100644 --- a/base/src/org/compiere/db/CConnectionEditor.java +++ b/base/src/org/compiere/db/CConnectionEditor.java @@ -22,6 +22,7 @@ import javax.swing.*; import org.adempiere.plaf.AdempierePLAF; import org.compiere.swing.*; +import org.compiere.util.DB; /** * Connection Editor. @@ -276,6 +277,11 @@ public class CConnectionEditor extends JComponent setValue(cd.getConnection()); if (!cd.isCancel()) fireActionPerformed(); + else { + DB.closeTarget(); + DB.setDBTarget(m_value); + } + // setCursor(Cursor.getDefaultCursor()); m_active = false; diff --git a/base/src/org/compiere/util/DB.java b/base/src/org/compiere/util/DB.java index 1770c848d8..7a7da91a29 100644 --- a/base/src/org/compiere/util/DB.java +++ b/base/src/org/compiere/util/DB.java @@ -384,8 +384,11 @@ public final class DB */ public static Connection createConnection (boolean autoCommit, int trxLevel) { - //wan profile - if (CConnection.get().isRMIoverHTTP() || CConnection.get().getDatabase().getStatus() == null) + //wan/vpn profile + if (CConnection.get().isRMIoverHTTP() || + (CConnection.get().isServerObjects() && + CConnection.get().isAppsServerOK(false) && + CConnection.get().getDatabase().getStatus() == null)) return new ServerConnection(); Connection conn = s_cc.getConnection (autoCommit, trxLevel); @@ -417,8 +420,11 @@ public final class DB */ public static Connection createConnection (boolean autoCommit, boolean readOnly, int trxLevel) { - //wan profile - if (CConnection.get().isRMIoverHTTP() || CConnection.get().getDatabase().getStatus() == null) + //wan/vpn profile + if (CConnection.get().isRMIoverHTTP() || + ( CConnection.get().isServerObjects() && + CConnection.get().isAppsServerOK(false) && + CConnection.get().getDatabase().getStatus() == null )) return new ServerConnection(); Connection conn = s_cc.getConnection (autoCommit, trxLevel);