org.apache.jackrabbit.core.persistence.bundle.util
Class ConnectionFactory

java.lang.Object
  extended by org.apache.jackrabbit.core.persistence.bundle.util.ConnectionFactory

public class ConnectionFactory
extends Object

A factory for new database connections. Supported are regular JDBC drivers, as well as JNDI resources.


Method Summary
static Connection getConnection(String driver, String url, String user, String password)
          Open a connection using the specified properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getConnection

public static Connection getConnection(String driver,
                                       String url,
                                       String user,
                                       String password)
                                throws RepositoryException,
                                       SQLException
Open a connection using the specified properties. The connection can be created using a JNDI Data Source as well. To do that, the driver class name must reference a javax.naming.Context class (for example javax.naming.InitialContext), and the URL must be the JNDI URL (for example java:comp/env/jdbc/Test).

Parameters:
driver - the JDBC driver or the Context class
url - the database URL
user - the user name
password - the password
Returns:
the connection
Throws:
RepositoryException - if the driver could not be loaded
SQLException - if the connection could not be established


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.