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);
|
p_properties.setProperty(key, value);
|
||||||
} // setProperty
|
} // setProperty
|
||||||
|
|
||||||
|
public void dbChanged() {
|
||||||
|
p_properties.remove(ADEMPIERE_DB_NAME);
|
||||||
|
p_properties.remove(ADEMPIERE_DB_PORT);
|
||||||
|
}
|
||||||
|
|
||||||
} // ConfigurationData
|
} // ConfigurationData
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class ConfigurationConsole {
|
||||||
|
|
||||||
dbExists(reader, writer);
|
dbExists(reader, writer);
|
||||||
dbType(reader, writer);
|
dbType(reader, writer);
|
||||||
|
|
||||||
dbHostname(reader, writer);
|
dbHostname(reader, writer);
|
||||||
dbPort(reader, writer);
|
dbPort(reader, writer);
|
||||||
dbName(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);
|
writer.println("Invalid input, please enter numeric value of 1 to " + ConfigurationData.DBTYPE.length);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (dbTypeSelected+1 != inputIndex)
|
||||||
|
data.dbChanged();
|
||||||
data.initDatabase(ConfigurationData.DBTYPE[inputIndex-1]);
|
data.initDatabase(ConfigurationData.DBTYPE[inputIndex-1]);
|
||||||
data.setDatabaseType(ConfigurationData.DBTYPE[inputIndex-1]);
|
data.setDatabaseType(ConfigurationData.DBTYPE[inputIndex-1]);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,6 +30,7 @@ import java.util.regex.Pattern;
|
||||||
import org.adempiere.install.DBConfigStatus;
|
import org.adempiere.install.DBConfigStatus;
|
||||||
import org.adempiere.install.IDBConfigMonitor;
|
import org.adempiere.install.IDBConfigMonitor;
|
||||||
import org.adempiere.install.IDatabaseConfig;
|
import org.adempiere.install.IDatabaseConfig;
|
||||||
|
import org.compiere.db.AdempiereDatabase;
|
||||||
import org.compiere.db.Database;
|
import org.compiere.db.Database;
|
||||||
import org.compiere.install.ConfigurationData;
|
import org.compiere.install.ConfigurationData;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
@ -60,6 +61,8 @@ public class ConfigOracle implements IDatabaseConfig
|
||||||
/** Express Edition */
|
/** Express Edition */
|
||||||
private boolean m_XE = false;
|
private boolean m_XE = false;
|
||||||
|
|
||||||
|
private AdempiereDatabase p_db = Database.getDatabase(Database.DB_ORACLE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init
|
* Init
|
||||||
*/
|
*/
|
||||||
|
@ -356,14 +359,19 @@ public class ConfigOracle implements IDatabaseConfig
|
||||||
String url = "jdbc:oracle:thin:@//" + databaseServer.getHostName()
|
String url = "jdbc:oracle:thin:@//" + databaseServer.getHostName()
|
||||||
+ ":" + databasePort
|
+ ":" + databasePort
|
||||||
+ "/" + databaseName;
|
+ "/" + databaseName;
|
||||||
pass = testJDBC(url, "system", systemPassword);
|
pass = testJDBC(url, p_db.getSystemUser(), systemPassword);
|
||||||
error = "Error connecting: " + url
|
error = "Error connecting: " + url
|
||||||
+ " - as system/" + systemPassword;
|
+ " - as "+ p_db.getSystemUser() + "/" + systemPassword;
|
||||||
if (monitor != null)
|
if (monitor != null)
|
||||||
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC",
|
monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SYSTEM_PASSWORD, "ErrorJDBC",
|
||||||
pass, true, error));
|
pass, true, error));
|
||||||
if (!pass)
|
if (!pass) {
|
||||||
|
if (isDBExists) {
|
||||||
|
log.warning(error);
|
||||||
|
} else {
|
||||||
return error;
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (log.isLoggable(Level.INFO)) log.info("OK: Connection = " + url);
|
if (log.isLoggable(Level.INFO)) log.info("OK: Connection = " + url);
|
||||||
data.setProperty(ConfigurationData.ADEMPIERE_DB_URL, url);
|
data.setProperty(ConfigurationData.ADEMPIERE_DB_URL, url);
|
||||||
if (log.isLoggable(Level.INFO)) log.info("OK: Database System User " + databaseName);
|
if (log.isLoggable(Level.INFO)) log.info("OK: Database System User " + databaseName);
|
||||||
|
@ -421,7 +429,7 @@ public class ConfigOracle implements IDatabaseConfig
|
||||||
}
|
}
|
||||||
if (testFile != null) {
|
if (testFile != null) {
|
||||||
// TNS Name Info via sqlplus
|
// TNS Name Info via sqlplus
|
||||||
String sqlplus = "sqlplus system/" + systemPassword + "@"
|
String sqlplus = "sqlplus " + p_db.getSystemUser() + "/" + systemPassword + "@"
|
||||||
+ "//" + databaseServer.getHostName()
|
+ "//" + databaseServer.getHostName()
|
||||||
+ ":" + databasePort
|
+ ":" + databasePort
|
||||||
+ "/" + databaseName
|
+ "/" + databaseName
|
||||||
|
@ -444,7 +452,7 @@ public class ConfigOracle implements IDatabaseConfig
|
||||||
if (System.getProperty("TestOCI", "N").equals("Y"))
|
if (System.getProperty("TestOCI", "N").equals("Y"))
|
||||||
{
|
{
|
||||||
url = "jdbc:oracle:oci8:@" + databaseName;
|
url = "jdbc:oracle:oci8:@" + databaseName;
|
||||||
pass = testJDBC(url, "system", systemPassword);
|
pass = testJDBC(url, p_db.getSystemUser(), systemPassword);
|
||||||
if (pass) {
|
if (pass) {
|
||||||
if (log.isLoggable(Level.INFO)) log.info("OK: Connection = " + url);
|
if (log.isLoggable(Level.INFO)) log.info("OK: Connection = " + url);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -411,7 +411,10 @@ public class DB_Oracle implements AdempiereDatabase
|
||||||
*/
|
*/
|
||||||
public String getSystemUser()
|
public String getSystemUser()
|
||||||
{
|
{
|
||||||
return "system";
|
String systemUser = System.getProperty("ADEMPIERE_DB_SYSTEM_USER");
|
||||||
|
if (systemUser == null)
|
||||||
|
systemUser = "system";
|
||||||
|
return systemUser;
|
||||||
} // getSystemUser
|
} // getSystemUser
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -383,7 +383,10 @@ public class DB_PostgreSQL implements AdempiereDatabase
|
||||||
*/
|
*/
|
||||||
public String getSystemUser()
|
public String getSystemUser()
|
||||||
{
|
{
|
||||||
return "postgres";
|
String systemUser = System.getProperty("ADEMPIERE_DB_SYSTEM_USER");
|
||||||
|
if (systemUser == null)
|
||||||
|
systemUser = "postgres";
|
||||||
|
return systemUser;
|
||||||
} // getSystemUser
|
} // getSystemUser
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue