Commit 79ffe76c authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[JM-1317] Fixed loading of test SQL and included DB2 proper check.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/branches/openfire_3_5_1@10189 b35dd754-fafc-0310-a699-88a17e54d16e
parent 760a21fd
......@@ -51,10 +51,6 @@ public class DbConnectionManager {
private static boolean scrollResultsSupported;
// True if the database supports batch updates.
private static boolean batchUpdatesSupported;
// True if the database supports the dual table.
private static boolean dualTableSupported;
// True if the database does not support select without from.
private static boolean selectRequiresFrom;
private static DatabaseType databaseType = DatabaseType.unknown;
......@@ -692,8 +688,6 @@ public class DbConnectionManager {
streamTextRequired = false;
maxRowsSupported = true;
fetchSizeSupported = true;
dualTableSupported = false;
selectRequiresFrom = false;
// Get the database name so that we can perform meta data settings.
String dbName = metaData.getDatabaseProductName().toLowerCase();
......@@ -704,8 +698,6 @@ public class DbConnectionManager {
databaseType = DatabaseType.oracle;
streamTextRequired = true;
scrollResultsSupported = false;
dualTableSupported = true;
selectRequiresFrom = true;
// The i-net AUGURO JDBC driver
if (driverName.indexOf("auguro") != -1) {
streamTextRequired = false;
......@@ -739,7 +731,6 @@ public class DbConnectionManager {
else if (dbName.indexOf("mysql") != -1) {
databaseType = DatabaseType.mysql;
transactionsSupported = false;
dualTableSupported = true;
}
// HSQL properties
else if (dbName.indexOf("hsql") != -1) {
......@@ -821,18 +812,22 @@ public class DbConnectionManager {
return batchUpdatesSupported;
}
public static boolean isDualTableSupported() {
return dualTableSupported;
}
public static boolean doesSelectRequireFrom() {
return selectRequiresFrom;
}
public static boolean isEmbeddedDB() {
return connectionProvider != null && connectionProvider instanceof EmbeddedConnectionProvider;
}
public static String getTestSQL(String driver) {
if (driver.contains("db2")) {
return "select current_timestamp from sysibm.sysdummy1";
}
else if (driver.contains("oracle")) {
return "select 1 from dual";
}
else {
return "select 1";
}
}
/**
* A class that identifies the type of the database that Jive is connected
* to. In most cases, we don't want to make any database specific calls
......
......@@ -322,11 +322,6 @@ public class DefaultConnectionProvider implements ConnectionProvider {
*/
private void loadProperties() {
String defTestSQL = "select 1";
if (DbConnectionManager.isDualTableSupported() && DbConnectionManager.doesSelectRequireFrom()) {
defTestSQL = defTestSQL + " from dual";
}
driver = JiveGlobals.getXMLProperty("database.defaultProvider.driver");
serverURL = JiveGlobals.getXMLProperty("database.defaultProvider.serverURL");
username = JiveGlobals.getXMLProperty("database.defaultProvider.username");
......@@ -334,7 +329,7 @@ public class DefaultConnectionProvider implements ConnectionProvider {
String minCons = JiveGlobals.getXMLProperty("database.defaultProvider.minConnections");
String maxCons = JiveGlobals.getXMLProperty("database.defaultProvider.maxConnections");
String conTimeout = JiveGlobals.getXMLProperty("database.defaultProvider.connectionTimeout");
testSQL = JiveGlobals.getXMLProperty("database.defaultProvider.testSQL", defTestSQL);
testSQL = JiveGlobals.getXMLProperty("database.defaultProvider.testSQL", DbConnectionManager.getTestSQL(driver));
testBeforeUse = JiveGlobals.getXMLProperty("database.defaultProvider.testBeforeUse", true);
testAfterUse = JiveGlobals.getXMLProperty("database.defaultProvider.testAfterUse", true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment