IDEMPIERE-3795 Oracle user System is 'fixed' on the code / Implement JVM variable -DADEMPIERE_DB_SYSTEM_USER to indicate a different user than system(oracle) or postgres(postgresql) - useful for AWS / fix problem with oracle stopping installation even if the database exists if the system password is not provided
This commit is contained in:
parent
d3ddf88d83
commit
0cf7b3b04f
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
|
@ -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
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue