Project

General

Profile

1
/**
2
 *        Name: MetaCatUtil.java
3
 *     Purpose: A Class that implements utility methods for a metadata catalog
4
 *   Copyright: 2000 Regents of the University of California and the
5
 *              National Center for Ecological Analysis and Synthesis
6
 *     Authors: Matt Jones
7
 * 
8
 *     Version: '$Id: MetaCatUtil.java 82 2000-05-05 21:50:00Z jones $'
9
 */
10

    
11
package edu.ucsb.nceas.metacat;
12

    
13
import java.sql.Connection;
14
import java.sql.DriverManager;
15
import java.sql.SQLException;
16

    
17
/**
18
 * A suite of utility classes for the metadata catalog server
19
 */
20
public class MetaCatUtil {
21

    
22
  /** 
23
   * Utility method to establish a JDBC database connection 
24
   *
25
   * @param dbDriver the string representing the database driver
26
   * @param connection the string representing the database connectin parameters
27
   * @param user name of the user to use for database connection
28
   * @param password password for the user to use for database connection
29
   */
30
  public static Connection openDBConnection(String dbDriver, String connection,
31
                String user, String password)
32
                throws SQLException, ClassNotFoundException {
33

    
34
     // Load the Oracle JDBC driver
35
     Class.forName (dbDriver);
36

    
37
     // Connect to the database
38
     Connection conn = DriverManager.getConnection( connection, user, password);
39
     return conn;
40
  }
41
}
(14-14/27)