r4561 - trunk/src/edu/ucsb/nceas/metacat/admin
daigle at ecoinformatics.org
daigle at ecoinformatics.org
Thu Nov 13 15:20:40 PST 2008
Author: daigle
Date: 2008-11-13 15:20:40 -0800 (Thu, 13 Nov 2008)
New Revision: 4561
Modified:
trunk/src/edu/ucsb/nceas/metacat/admin/DBAdmin.java
Log:
When checking oracle metadata, table names must be in upper case. For postgres, it's however the table was created.
Modified: trunk/src/edu/ucsb/nceas/metacat/admin/DBAdmin.java
===================================================================
--- trunk/src/edu/ucsb/nceas/metacat/admin/DBAdmin.java 2008-11-13 23:19:24 UTC (rev 4560)
+++ trunk/src/edu/ucsb/nceas/metacat/admin/DBAdmin.java 2008-11-13 23:20:40 UTC (rev 4561)
@@ -272,12 +272,13 @@
// don't even try to search for a database version until system
// properties have been configured
try {
- if (!PropertyService.arePropertiesConfigured()) {
- throw new AdminException("An attempt was made to get the database version "
- + "before system properties were configured");
- }
+ if (!PropertyService.arePropertiesConfigured()) {
+ throw new AdminException("An attempt was made to get the database version "
+ + "before system properties were configured");
+ }
} catch (UtilException ue) {
- throw new AdminException("Could not determine the database version: " + ue.getMessage());
+ throw new AdminException("Could not determine the database version: "
+ + ue.getMessage());
}
if (databaseVersion == null) {
databaseVersion = discoverDBVersion();
@@ -549,8 +550,15 @@
* the meta data for this database.
* @returns boolean which is true if index is found, false otherwise
*/
- private boolean is1_8_0(Connection connection) throws SQLException {
- return DBUtil.indexExists(connection, "xml_nodes", "xml_nodes_idx4");
+ private boolean is1_8_0(Connection connection) throws SQLException, PropertyNotFoundException {
+ String tableName = "xml_nodes";
+ String dbType = PropertyService.getProperty("database.type");
+
+ boolean isOracle = dbType.equals("oracle");
+ if(isOracle) {
+ tableName = "XML_NODES";
+ }
+ return DBUtil.indexExists(connection, tableName, "xml_nodes_idx4");
}
/**
@@ -564,9 +572,16 @@
* the meta data for this database.
* @returns boolean which is true if index is found, false otherwise
*/
- private boolean is1_7_0(Connection connection) throws SQLException {
- return DBUtil.indexExists(connection, "xml_documents",
- "xml_documents_idx2");
+ private boolean is1_7_0(Connection connection) throws SQLException, PropertyNotFoundException {
+ String tableName = "xml_documents";
+ String dbType = PropertyService.getProperty("database.type");
+
+ boolean isOracle = dbType.equals("oracle");
+ if(isOracle) {
+ tableName = "XML_DOCUMENTS";
+ }
+
+ return DBUtil.indexExists(connection, tableName, "xml_documents_idx2");
}
/**
More information about the Metacat-cvs
mailing list