|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enableit.db.ConnFactory
Factory for database connections.
This is a functional replacement for the
ConnectionFactory
that has been deprecated
as it contains a great deal of legacy (and not very clean) code.
Constructor Summary | |
protected |
ConnFactory()
Constructor, prevents public construction. |
Method Summary | |
static java.sql.Connection |
getConnection(org.enableit.db.beans.Provider provider)
Returns a connection to the database identified within the supplied provider. |
static java.sql.Connection |
getConnection(java.lang.String name)
Obtain connection for the named configuration. |
protected static void |
registerDriver(java.lang.String driver)
Register the named driver class with DriverManager . |
protected static void |
registerDriverFromUrl(java.lang.String url)
Attempt to decode the JDBC URL and register the driver if it is of known type. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
protected ConnFactory()
Method Detail |
public static java.sql.Connection getConnection(org.enableit.db.beans.Provider provider) throws DBException
Parameters may be empty strings, but may not be null.
provider
- Contains connection details.
DBException
- in the event of a problem creating the connectionprotected static void registerDriver(java.lang.String driver)
DriverManager
.
driver
- Name of driver class.protected static void registerDriverFromUrl(java.lang.String url)
url
- Database URL to connect to.public static java.sql.Connection getConnection(java.lang.String name) throws DBException
Implementation Note: The name will first be treated as a JDBC2
DataSource
name to be looked up in the local naming
context. If that fails the ConnectionFactory will fall back on its own
configuration to attempt to obtain a connection.
name
- Data source configuration name.
DBException
- If the named configuration is not found.#getConnectionNames
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |