From cdafec15226809b02632e92868c352af84557883 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 4 Sep 2012 18:14:17 -0500 Subject: [PATCH] IDEMPIERE-260 Configuration using Eclipse install.app does not work when db is Oracle / previous approach broke install.app --- org.adempiere.install/install.app.launch | 2 +- .../db/oracle/config/ConfigOracle.java | 34 +++++++++++++------ 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/org.adempiere.install/install.app.launch b/org.adempiere.install/install.app.launch index 2825f83ab9..13ba2d1018 100644 --- a/org.adempiere.install/install.app.launch +++ b/org.adempiere.install/install.app.launch @@ -16,7 +16,7 @@ - + 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 418290d2a1..0bac97f447 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 @@ -31,6 +31,7 @@ import org.adempiere.install.IDBConfigMonitor; import org.adempiere.install.IDatabaseConfig; import org.compiere.db.Database; import org.compiere.install.ConfigurationData; +import org.compiere.tools.FileUtil; import org.compiere.util.CLogger; /** @@ -387,15 +388,28 @@ public class ConfigOracle implements IDatabaseConfig ospath = "windows"; else ospath = "unix"; - // TNS Name Info via sqlplus - String sqlplus = "sqlplus system/" + systemPassword + "@" - + "//" + databaseServer.getHostName() - + ":" + databasePort - + "/" + databaseName - + " @utils." + ospath + "/oracle/Test.sql"; - log.config(sqlplus); - pass = testSQL(sqlplus); - error = "Error connecting via: " + sqlplus; + String testFile = "utils." + ospath + "/oracle/Test.sql"; + if (! new File(testFile).isFile()) { + testFile = "org.adempiere.server-feature/" + testFile; + if (! new File(testFile).isFile()) { + testFile = null; + } + } + if (testFile != null) { + // TNS Name Info via sqlplus + String sqlplus = "sqlplus system/" + systemPassword + "@" + + "//" + databaseServer.getHostName() + + ":" + databasePort + + "/" + databaseName + + " @" + testFile; + log.config(sqlplus); + pass = testSQL(sqlplus); + error = "Error connecting via: " + sqlplus; + } else { + pass = false; + error = "Test file does not exist"; + log.warning(error); + } if (monitor != null) monitor.update(new DBConfigStatus(DBConfigStatus.DATABASE_SQL_TEST, "ErrorTNS", pass, true, error)); @@ -411,7 +425,7 @@ public class ConfigOracle implements IDatabaseConfig log.info("OK: Connection = " + url); else log.warning("Cannot connect via Net8: " + url); - } + } else log.info("OCI Test Skipped"); //