dk.netarkivet.archive.arcrepositoryadmin
Class DBConnect

java.lang.Object
  extended by dk.netarkivet.archive.arcrepositoryadmin.DBConnect

public final class DBConnect
extends java.lang.Object

Logic to connect with the harvest definition database. This also defines basic logic for checking versions of tables. The statements to create the tables are in scripts/sql/createBitpreservationDB.sql


Method Summary
static void cleanup()
          Clears the pool of connections.
static java.lang.String getArchiveUrl()
          Method for retrieving the url for the archive database.
static java.sql.Connection getDBConnection(java.lang.String dbUrl)
          Get a connection to our database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDBConnection

public static java.sql.Connection getDBConnection(java.lang.String dbUrl)
                                           throws IOFailure,
                                                  ArgumentNotValid
Get a connection to our database. If a connection is already registered to the current thread, checks that it is valid, and if not renews it. This sets AutoCommit to false as part of getting a fresh connection.

Parameters:
dbUrl - The url to the database.
Returns:
a connection to our database.
Throws:
IOFailure - if we cannot connect to the database (or find the driver).
ArgumentNotValid - If the dbUrl is either null or the empty string.

getArchiveUrl

public static java.lang.String getArchiveUrl()
Method for retrieving the url for the archive database. This url will be constructed from the base-url, the machine, the port and the directory.

Returns:
The url for the archive database.

cleanup

public static void cleanup()
Clears the pool of connections.