dk.netarkivet.harvester.datamodel
Class DBConnect

java.lang.Object
  extended by dk.netarkivet.harvester.datamodel.DBConnect

public 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 now in scripts/sql/createfullhddb.sql


Constructor Summary
DBConnect()
           
 
Method Summary
static java.sql.Connection getDBConnection()
          Get a connection to our database.
protected static void updateTable(java.lang.String table, int newVersion, java.lang.String... updates)
          Update a table by executing all the statements in the updates String array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBConnect

public DBConnect()
Method Detail

getDBConnection

public static java.sql.Connection getDBConnection()
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. Assumes that AutoCommit is true.

Returns:
a connection to our database
Throws:
IOFailure - if we cannot connect to the database (or find the driver).

updateTable

protected static void updateTable(java.lang.String table,
                                  int newVersion,
                                  java.lang.String... updates)
Update a table by executing all the statements in the updates String array.

Parameters:
table - The table to update
newVersion - The version that the table should end up at
updates - The SQL update statements that makes the necessary updates.
Throws:
IOFailure - in case of problems in interacting with the database