Package org.apache.commons.dbcp2
Class DriverManagerConnectionFactory
java.lang.Object
org.apache.commons.dbcp2.DriverManagerConnectionFactory
- All Implemented Interfaces:
ConnectionFactory
A
DriverManager
-based implementation of ConnectionFactory
.- Since:
- 2.0
-
Constructor Summary
ConstructorDescriptionDriverManagerConnectionFactory
(String connectionUri) Constructor for DriverManagerConnectionFactory.DriverManagerConnectionFactory
(String connectionUri, String userName, char[] userPassword) Constructor for DriverManagerConnectionFactory.DriverManagerConnectionFactory
(String connectionUri, String userName, String userPassword) Constructor for DriverManagerConnectionFactory.DriverManagerConnectionFactory
(String connectionUri, Properties properties) Constructor for DriverManagerConnectionFactory. -
Method Summary
-
Constructor Details
-
DriverManagerConnectionFactory
Constructor for DriverManagerConnectionFactory.- Parameters:
connectionUri
- a database connection string of the formjdbc:<em>subprotocol</em>:<em>subname</em>
- Since:
- 2.2
-
DriverManagerConnectionFactory
Constructor for DriverManagerConnectionFactory.- Parameters:
connectionUri
- a database connection string of the formjdbc:<em>subprotocol</em>:<em>subname</em>
properties
- a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included.
-
DriverManagerConnectionFactory
Constructor for DriverManagerConnectionFactory.- Parameters:
connectionUri
- a database connection string of the formjdbc:<em>subprotocol</em>:<em>subname</em>
userName
- the database useruserPassword
- the user's password
-
DriverManagerConnectionFactory
Constructor for DriverManagerConnectionFactory.- Parameters:
connectionUri
- a database connection string of the formjdbc:<em>subprotocol</em>:<em>subname</em>
userName
- the database useruserPassword
- the user's password
-
-
Method Details
-
createConnection
Description copied from interface:ConnectionFactory
Create a newConnection
in an implementation specific fashion.- Specified by:
createConnection
in interfaceConnectionFactory
- Returns:
- a new
Connection
- Throws:
SQLException
- if a database error occurs creating the connection
-
getConnectionUri
- Returns:
- The connection URI.
- Since:
- 2.6.0
-
getProperties
- Returns:
- The Properties.
- Since:
- 2.6.0
-
getUserName
- Returns:
- The user name.
- Since:
- 2.6.0
-