Class ConnectionFactory

  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


public static Connection getConnection(String driver,
                                       String url,
                                       String user,
                                       String password)
                                throws RepositoryException,
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).

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

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