From 53d63d9c55401f15f209b6bf6018900e509ae321 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sat, 17 Nov 2007 08:53:36 +0000 Subject: [PATCH] [ 1833556 ] Ok in connection dialog doesn't always save changes [ 1833558 ] connection dialog test database fail on a new installation --- base/src/org/compiere/db/CConnectionEditor.java | 6 ++++++ base/src/org/compiere/util/DB.java | 14 ++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) 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);