[ 1833556 ] Ok in connection dialog doesn't always save changes

[ 1833558 ] connection dialog test database fail on a new installation
This commit is contained in:
Heng Sin Low 2007-11-17 08:53:36 +00:00
parent ba173b03d3
commit 53d63d9c55
2 changed files with 16 additions and 4 deletions

View File

@ -22,6 +22,7 @@ import javax.swing.*;
import org.adempiere.plaf.AdempierePLAF; import org.adempiere.plaf.AdempierePLAF;
import org.compiere.swing.*; import org.compiere.swing.*;
import org.compiere.util.DB;
/** /**
* Connection Editor. * Connection Editor.
@ -276,6 +277,11 @@ public class CConnectionEditor extends JComponent
setValue(cd.getConnection()); setValue(cd.getConnection());
if (!cd.isCancel()) if (!cd.isCancel())
fireActionPerformed(); fireActionPerformed();
else {
DB.closeTarget();
DB.setDBTarget(m_value);
}
// //
setCursor(Cursor.getDefaultCursor()); setCursor(Cursor.getDefaultCursor());
m_active = false; m_active = false;

View File

@ -384,8 +384,11 @@ public final class DB
*/ */
public static Connection createConnection (boolean autoCommit, int trxLevel) public static Connection createConnection (boolean autoCommit, int trxLevel)
{ {
//wan profile //wan/vpn profile
if (CConnection.get().isRMIoverHTTP() || CConnection.get().getDatabase().getStatus() == null) if (CConnection.get().isRMIoverHTTP() ||
(CConnection.get().isServerObjects() &&
CConnection.get().isAppsServerOK(false) &&
CConnection.get().getDatabase().getStatus() == null))
return new ServerConnection(); return new ServerConnection();
Connection conn = s_cc.getConnection (autoCommit, trxLevel); 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) public static Connection createConnection (boolean autoCommit, boolean readOnly, int trxLevel)
{ {
//wan profile //wan/vpn profile
if (CConnection.get().isRMIoverHTTP() || CConnection.get().getDatabase().getStatus() == null) if (CConnection.get().isRMIoverHTTP() ||
( CConnection.get().isServerObjects() &&
CConnection.get().isAppsServerOK(false) &&
CConnection.get().getDatabase().getStatus() == null ))
return new ServerConnection(); return new ServerConnection();
Connection conn = s_cc.getConnection (autoCommit, trxLevel); Connection conn = s_cc.getConnection (autoCommit, trxLevel);