public final class HarvestDBConnection extends Object
The statements to create the tables are located in:
The implementation relies on a connection pool. Once acquired through the get() method, a connection must be explicitly returned to the pool by calling the release(Connection) method.
THis class is intended to be used statically, and hence cannot be instantiated and is final.
Modifier and Type | Method and Description |
---|---|
static void |
cleanup()
Closes the underlying data source.
|
static Connection |
get()
Get a connection to the harvest definition database from the pool.
|
static String |
getDBUrl()
Method for retrieving the url for the harvest definition database.
|
static void |
release(Connection connection)
Helper method to return a connection to the pool.
|
static void |
updateTable(Connection c,
String table,
int newVersion,
String... updates) |
protected static void |
updateTable(String table,
int newVersion,
String... updates)
Update a table by executing all the statements in the updates String array.
|
public static Connection get()
CommonSettings.DB_POOL_MIN_SIZE
CommonSettings.DB_POOL_MAX_SIZE
CommonSettings.DB_POOL_ACQ_INC
release(Connection)
.IOFailure
- if we cannot connect to the database (or find the driver).protected static void updateTable(String table, int newVersion, String... updates)
table
- The table to updatenewVersion
- The version that the table should end up atupdates
- The SQL update statements that makes the necessary updates.IOFailure
- in case of problems in interacting with the databasepublic static void updateTable(Connection c, String table, int newVersion, String... updates)
public static String getDBUrl()
public static void cleanup()
public static void release(Connection connection)
connection
- a connectionCopyright © 2005–2015 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.