org.apache.jackrabbit.core.persistence.bundle.util
Class ConnectionFactory
java.lang.Object
org.apache.jackrabbit.core.persistence.bundle.util.ConnectionFactory
public class ConnectionFactory
- extends java.lang.Object
A factory for new database connections.
Supported are regular JDBC drivers, as well as
JNDI resources.
|
Method Summary |
static java.sql.Connection |
getConnection(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.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 |
getConnection
public static java.sql.Connection getConnection(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String password)
throws javax.jcr.RepositoryException,
java.sql.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:
javax.jcr.RepositoryException - if the driver could not be loaded
java.sql.SQLException - if the connection could not be established
Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.