Package org.apache.commons.dbcp
Class DriverManagerConnectionFactory
- java.lang.Object
-
- org.apache.commons.dbcp.DriverManagerConnectionFactory
-
- All Implemented Interfaces:
ConnectionFactory
public class DriverManagerConnectionFactory extends java.lang.Object implements ConnectionFactory
ADriverManager
-based implementation ofConnectionFactory
.- Version:
- $Revision: 746827 $ $Date: 2009-02-22 16:41:52 -0500 (Sun, 22 Feb 2009) $
- Author:
- Rodney Waldhoff, Ignacio J. Ortega, Dirk Verbeeck
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
_connectUri
protected java.lang.String
_passwd
protected java.util.Properties
_props
protected java.lang.String
_uname
-
Constructor Summary
Constructors Constructor Description DriverManagerConnectionFactory(java.lang.String connectUri, java.lang.String uname, java.lang.String passwd)
Constructor for DriverManagerConnectionFactory.DriverManagerConnectionFactory(java.lang.String connectUri, java.util.Properties props)
Constructor for DriverManagerConnectionFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.Connection
createConnection()
Create a newConnection
in an implementation specific fashion.
-
-
-
Constructor Detail
-
DriverManagerConnectionFactory
public DriverManagerConnectionFactory(java.lang.String connectUri, java.util.Properties props)
Constructor for DriverManagerConnectionFactory.- Parameters:
connectUri
- a database url of the formjdbc:subprotocol:subname
props
- a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included.
-
DriverManagerConnectionFactory
public DriverManagerConnectionFactory(java.lang.String connectUri, java.lang.String uname, java.lang.String passwd)
Constructor for DriverManagerConnectionFactory.- Parameters:
connectUri
- a database url of the formjdbc:subprotocol:subname
uname
- the database userpasswd
- the user's password
-
-
Method Detail
-
createConnection
public java.sql.Connection createConnection() throws java.sql.SQLException
Description copied from interface:ConnectionFactory
Create a newConnection
in an implementation specific fashion.- Specified by:
createConnection
in interfaceConnectionFactory
- Returns:
- a new
Connection
- Throws:
java.sql.SQLException
- if a database error occurs creating the connection
-
-