org.jminor.common.db
Class DatabaseConnections

java.lang.Object
  extended by org.jminor.common.db.DatabaseConnections

public final class DatabaseConnections
extends Object


Method Summary
static DatabaseConnection createConnection(Database database, User user)
          Constructs a new DatabaseConnection instance, based on the given Connection object.
static DatabaseConnection createConnection(Database database, User user, Connection connection)
          Constructs a new DatabaseConnection instance, based on the given Connection object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createConnection

public static DatabaseConnection createConnection(Database database,
                                                  User user)
                                           throws ClassNotFoundException,
                                                  SQLException
Constructs a new DatabaseConnection instance, based on the given Connection object. NB. auto commit is disabled on the Connection that is provided.

Parameters:
database - the database
user - the user for the db-connection
Returns:
a new DatabaseConnection instance
Throws:
SQLException - in case there is a problem connecting to the database
ClassNotFoundException - in case the JDBC driver class was not found

createConnection

public static DatabaseConnection createConnection(Database database,
                                                  User user,
                                                  Connection connection)
                                           throws SQLException
Constructs a new DatabaseConnection instance, based on the given Connection object. NB. auto commit is disabled on the Connection that is provided.

Parameters:
database - the database
user - the user for the db-connection
connection - the Connection object to base this DatabaseConnection on
Returns:
a new DatabaseConnection instance
Throws:
SQLException - in case there is a problem connecting to the database