Project

General

Profile

« Previous | Next » 

Revision 4080

Added by daigle about 16 years ago

Merge 1.9 changes into Head

View differences:

upgrade_db_to_1_5.java
33 33
import java.sql.SQLException;
34 34
import java.sql.DriverManager;
35 35

  
36
import edu.ucsb.nceas.metacat.MetaCatUtil;
36
import edu.ucsb.nceas.metacat.service.PropertyService;
37
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
37 38

  
38 39
public class upgrade_db_to_1_5{
39 40

  
40
    static String database = MetaCatUtil.getOption("databaseType");
41
    static String url = MetaCatUtil.getOption("defaultDB");
42
    static String user = MetaCatUtil.getOption("user");
43
    static String password = MetaCatUtil.getOption("password");
41
    static String database = null;
42
    static String url = null;
43
    static String user = null;
44
    static String password = null;
45
    static {
46
    	try {
47
    	    database = PropertyService.getProperty("database.type");
48
    	    url = PropertyService.getProperty("database.connectionURI");
49
    	    user = PropertyService.getProperty("database.user");
50
    	    password = PropertyService.getProperty("database.password");
51
    	} catch (PropertyNotFoundException pnfe) {
52
            System.err.println("Error in upgrade_db_to_1_5 static block:"
53
                    + pnfe.getMessage());
54
            pnfe.printStackTrace();
55
    	}
56
     }
44 57

  
45 58
    public static void upgrade_xml_nodes(Connection sqlca) throws SQLException{
46 59
        Statement sqlStatement = null;
......
134 147
            Connection sqlca = null;
135 148

  
136 149
            // Create a JDBC connection to the database
137
            if (database.equals("oracle") {
150
            if (database.equals("oracle")) {
138 151
            	DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
139 152
            } 
140 153
            else if (database.equals("postgresql")) {

Also available in: Unified diff