org.koala.koalautil
Class DBUtil

java.lang.Object
  |
  +--org.koala.koalautil.DBUtil

public class DBUtil
extends java.lang.Object

Provides methods to handle datadataBaseName connections


Constructor Summary
DBUtil()
           
 
Method Summary
static int createId(java.lang.String idName, java.lang.String dbase, java.lang.String idTable)
           
static java.sql.Connection getConnection(java.lang.String dataBaseName)
          Obtains a connection from a database specified in the system's configuration file
static java.sql.Connection getGenericConnection(java.lang.String driver, java.lang.String url, java.lang.String username, java.lang.String password)
          connects to a generic database
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBUtil

public DBUtil()
Method Detail

createId

public static int createId(java.lang.String idName,
                           java.lang.String dbase,
                           java.lang.String idTable)
                    throws ChainedException
ChainedException

getConnection

public static java.sql.Connection getConnection(java.lang.String dataBaseName)
                                         throws ChainedException
Obtains a connection from a database specified in the system's configuration file

Parameters:
dataBaseName - the name of the database to connect to as specified in the system's configuration file
Returns:
a connection to the given database
Throws:
ChainedException - if the connection cannot be obtained

getGenericConnection

public static java.sql.Connection getGenericConnection(java.lang.String driver,
                                                       java.lang.String url,
                                                       java.lang.String username,
                                                       java.lang.String password)
                                                throws ChainedException
connects to a generic database

Parameters:
driver - the driver to use
url - the connection's url
username - the username to use in the connection
password - the password associated with the username
Returns:
a connection to the database
Throws:
ChainedException - if the connection cannot be obtained