public final class ConnectionFactory extends Object
| Constructor and Description |
|---|
ConnectionFactory() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String |
getDataBaseType(String logicalName) |
DataSource |
getDataSource(String logicalName)
Retrieves a configured data source by logical name.
|
DataSource |
getDataSource(String driver,
String url,
String user,
String password)
Retrieve a
DataSource for the specified properties. |
void |
registerDataSources(DataSourceConfig dsc)
Registers a number of data sources.
|
static Connection |
unwrap(Connection con)
Needed for pre-10R2 Oracle blob support....:(
This method actually assumes that we are using commons DBCP 1.2.2.
|
public void registerDataSources(DataSourceConfig dsc) throws RepositoryException
dsc - the DataSourceConfig which contains the configurationRepositoryExceptionpublic DataSource getDataSource(String logicalName) throws RepositoryException
logicalName - the name of the DataSourceDataSourceRepositoryException - if there is no DataSource with the given namepublic String getDataBaseType(String logicalName) throws RepositoryException
logicalName - the name of the DataSourceRepositoryException - if there is no DataSource with the given namepublic DataSource getDataSource(String driver, String url, String user, String password) throws RepositoryException, SQLException
DataSource for the specified properties.
This can be 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 classurl - the database URLuser - the user namepassword - the passwordDataSourceRepositoryException - if the driver could not be loadedSQLException - if the connection could not be establishedpublic void close()
public static Connection unwrap(Connection con) throws SQLException
con - the commons-DBCP DelegatingConnection to unwrapSQLExceptionCopyright © 2004–2021 The Apache Software Foundation. All rights reserved.