diff --git a/org.adempiere.install/src/org/compiere/install/ConfigurationData.java b/org.adempiere.install/src/org/compiere/install/ConfigurationData.java index 1d862e2312..4c26a33fc7 100644 --- a/org.adempiere.install/src/org/compiere/install/ConfigurationData.java +++ b/org.adempiere.install/src/org/compiere/install/ConfigurationData.java @@ -1569,4 +1569,10 @@ public class ConfigurationData { p_properties.setProperty(key, value); } // setProperty + + public void dbChanged() { + p_properties.remove(ADEMPIERE_DB_NAME); + p_properties.remove(ADEMPIERE_DB_PORT); + } + } // ConfigurationData diff --git a/org.adempiere.install/src/org/compiere/install/console/ConfigurationConsole.java b/org.adempiere.install/src/org/compiere/install/console/ConfigurationConsole.java index 81829c1359..643b12273e 100644 --- a/org.adempiere.install/src/org/compiere/install/console/ConfigurationConsole.java +++ b/org.adempiere.install/src/org/compiere/install/console/ConfigurationConsole.java @@ -55,6 +55,7 @@ public class ConfigurationConsole { dbExists(reader, writer); dbType(reader, writer); + dbHostname(reader, writer); dbPort(reader, writer); dbName(reader, writer); @@ -475,6 +476,8 @@ public class ConfigurationConsole { writer.println("Invalid input, please enter numeric value of 1 to " + ConfigurationData.DBTYPE.length); continue; } + if (dbTypeSelected+1 != inputIndex) + data.dbChanged(); data.initDatabase(ConfigurationData.DBTYPE[inputIndex-1]); data.setDatabaseType(ConfigurationData.DBTYPE[inputIndex-1]); break; diff --git a/org.compiere.db.oracle.provider/src/org/adempiere/db/oracle/config/ConfigOracle.java b/org.compiere.db.oracle.provider/src/org/adempiere/db/oracle/config/ConfigOracle.java index 8f0ae3a057..2e4ad68249 100644 --- a/org.compiere.db.oracle.provider/src/org/adempiere/db/oracle/config/ConfigOracle.java +++ b/org.compiere.db.oracle.provider/src/org/adempiere/db/oracle/config/ConfigOracle.java @@ -30,6 +30,7 @@ import java.util.regex.Pattern; import org.adempiere.install.DBConfigStatus; import org.adempiere.install.IDBConfigMonitor; import org.adempiere.install.IDatabaseConfig; +import org.compiere.db.AdempiereDatabase; import org.compiere.db.Database; import org.compiere.install.ConfigurationData; import org.compiere.util.CLogger; @@ -60,6 +61,8 @@ public class ConfigOracle implements IDatabaseConfig /** Express Edition */ private boolean m_XE = false; + private AdempiereDatabase p_db = Database.getDatabase(Database.DB_ORACLE); + /** * Init */ @@ -356,14 +359,19 @@ public class ConfigOracle implements IDatabaseConfig String url = "jdbc:oracle:thin:@//" + databaseServer.getHostName() + ":" + databasePort + "/" + databaseName; - pass = testJDBC(url, "system", systemPassword); + pass = testJDBC(url, p_db.getSystemUser(), systemPassword); error = "Error connecting: " + url - + " - as system/" + systemPassword; + + " - as "+ p_db.getSystemUser() + "/" + systemPassword; if (monitor != null) monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC", pass, true, error)); - if (!pass) - return error; + if (!pass) { + if (isDBExists) { + log.warning(error); + } else { + return error; + } + } if (log.isLoggable(Level.INFO)) log.info("OK: Connection = " + url); data.setProperty(ConfigurationData.ADEMPIERE_DB_URL, url); if (log.isLoggable(Level.INFO)) log.info("OK: Database System User " + databaseName); @@ -421,7 +429,7 @@ public class ConfigOracle implements IDatabaseConfig } if (testFile != null) { // TNS Name Info via sqlplus - String sqlplus = "sqlplus system/" + systemPassword + "@" + String sqlplus = "sqlplus " + p_db.getSystemUser() + "/" + systemPassword + "@" + "//" + databaseServer.getHostName() + ":" + databasePort + "/" + databaseName @@ -444,7 +452,7 @@ public class ConfigOracle implements IDatabaseConfig if (System.getProperty("TestOCI", "N").equals("Y")) { url = "jdbc:oracle:oci8:@" + databaseName; - pass = testJDBC(url, "system", systemPassword); + pass = testJDBC(url, p_db.getSystemUser(), systemPassword); if (pass) { if (log.isLoggable(Level.INFO)) log.info("OK: Connection = " + url); } else { diff --git a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java index 688f76b5a5..0daa0418e1 100644 --- a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java +++ b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java @@ -411,7 +411,10 @@ public class DB_Oracle implements AdempiereDatabase */ public String getSystemUser() { - return "system"; + String systemUser = System.getProperty("ADEMPIERE_DB_SYSTEM_USER"); + if (systemUser == null) + systemUser = "system"; + return systemUser; } // getSystemUser /** diff --git a/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java b/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java index e65fa74e81..30db4bfec3 100755 --- a/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java +++ b/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java @@ -383,7 +383,10 @@ public class DB_PostgreSQL implements AdempiereDatabase */ public String getSystemUser() { - return "postgres"; + String systemUser = System.getProperty("ADEMPIERE_DB_SYSTEM_USER"); + if (systemUser == null) + systemUser = "postgres"; + return systemUser; } // getSystemUser /**