public final class ConnectionFactory
extends java.lang.Object
Constructor and Description |
---|
ConnectionFactory() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
java.lang.String |
getDataBaseType(java.lang.String logicalName) |
javax.sql.DataSource |
getDataSource(java.lang.String logicalName)
Retrieves a configured data source by logical name.
|
javax.sql.DataSource |
getDataSource(java.lang.String driver,
java.lang.String url,
java.lang.String user,
java.lang.String password)
Retrieve a
DataSource for the specified properties. |
void |
registerDataSources(DataSourceConfig dsc)
Registers a number of data sources.
|
static java.sql.Connection |
unwrap(java.sql.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 configurationRepositoryException
public javax.sql.DataSource getDataSource(java.lang.String logicalName) throws RepositoryException
logicalName
- the name of the DataSource
DataSource
RepositoryException
- if there is no DataSource
with the given namepublic java.lang.String getDataBaseType(java.lang.String logicalName) throws RepositoryException
logicalName
- the name of the DataSource
RepositoryException
- if there is no DataSource
with the given namepublic javax.sql.DataSource getDataSource(java.lang.String driver, java.lang.String url, java.lang.String user, java.lang.String password) throws RepositoryException, java.sql.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 passwordDataSource
RepositoryException
- if the driver could not be loadedjava.sql.SQLException
- if the connection could not be establishedpublic void close()
public static java.sql.Connection unwrap(java.sql.Connection con) throws java.sql.SQLException
con
- the commons-DBCP DelegatingConnection
to unwrapjava.sql.SQLException
Copyright © 2010 - 2020 Adobe. All Rights Reserved