Project

General

Profile

Revision 4561

Added by daigle about 12 years ago

When checking oracle metadata, table names must be in upper case. For postgres, it's however the table was created.

View differences:

src/edu/ucsb/nceas/metacat/admin/DBAdmin.java
272 272
		// don't even try to search for a database version until system
273 273
		// properties have been configured
274 274
		try {
275
		if (!PropertyService.arePropertiesConfigured()) {
276
			throw new AdminException("An attempt was made to get the database version " 
277
					+ "before system properties were configured");
278
		}
275
			if (!PropertyService.arePropertiesConfigured()) {
276
				throw new AdminException("An attempt was made to get the database version "
277
								+ "before system properties were configured");
278
			}
279 279
		} catch (UtilException ue) {
280
			throw new AdminException("Could not determine the database version: " + ue.getMessage());
280
			throw new AdminException("Could not determine the database version: "
281
					+ ue.getMessage());
281 282
		}
282 283
		if (databaseVersion == null) {
283 284
			databaseVersion = discoverDBVersion();
......
549 550
	 *            the meta data for this database.
550 551
	 * @returns boolean which is true if index is found, false otherwise
551 552
	 */
552
	private boolean is1_8_0(Connection connection) throws SQLException {
553
		return DBUtil.indexExists(connection, "xml_nodes", "xml_nodes_idx4");
553
	private boolean is1_8_0(Connection connection) throws SQLException, PropertyNotFoundException {
554
		String tableName = "xml_nodes";
555
		String dbType = PropertyService.getProperty("database.type");
556
			
557
		boolean isOracle = dbType.equals("oracle");		
558
		if(isOracle) {
559
			tableName = "XML_NODES";
560
		}
561
		return DBUtil.indexExists(connection, tableName, "xml_nodes_idx4");
554 562
	}
555 563

  
556 564
	/**
......
564 572
	 *            the meta data for this database.
565 573
	 * @returns boolean which is true if index is found, false otherwise
566 574
	 */
567
	private boolean is1_7_0(Connection connection) throws SQLException {
568
		return DBUtil.indexExists(connection, "xml_documents",
569
				"xml_documents_idx2");
575
	private boolean is1_7_0(Connection connection) throws SQLException, PropertyNotFoundException {
576
		String tableName = "xml_documents";
577
		String dbType = PropertyService.getProperty("database.type");
578
			
579
		boolean isOracle = dbType.equals("oracle");		
580
		if(isOracle) {
581
			tableName = "XML_DOCUMENTS";
582
		}
583
	
584
		return DBUtil.indexExists(connection, tableName, "xml_documents_idx2");
570 585
	}
571 586

  
572 587
	/**

Also available in: Unified diff