org.apache.jackrabbit.core.persistence.bundle.util
Class ConnectionFactory
java.lang.Object
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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 classurl
- the database URLuser
- the user namepassword
- the password
- Returns:
- the connection
- Throws:
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.