Package org.apache.tomcat.dbcp.dbcp2
Class DriverManagerConnectionFactory
- java.lang.Object
-
- org.apache.tomcat.dbcp.dbcp2.DriverManagerConnectionFactory
-
- All Implemented Interfaces:
ConnectionFactory
public class DriverManagerConnectionFactory extends java.lang.Object implements ConnectionFactory
ADriverManager
-based implementation ofConnectionFactory
.- Since:
- 2.0
-
-
Constructor Summary
Constructors Constructor Description DriverManagerConnectionFactory(java.lang.String connectionUri)
Constructor for DriverManagerConnectionFactory.DriverManagerConnectionFactory(java.lang.String connectionUri, java.lang.String userName, char[] userPassword)
Constructor for DriverManagerConnectionFactory.DriverManagerConnectionFactory(java.lang.String connectionUri, java.lang.String userName, java.lang.String userPassword)
Constructor for DriverManagerConnectionFactory.DriverManagerConnectionFactory(java.lang.String connectionUri, java.util.Properties properties)
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.java.lang.String
getConnectionUri()
java.util.Properties
getProperties()
java.lang.String
getUserName()
-
-
-
Constructor Detail
-
DriverManagerConnectionFactory
public DriverManagerConnectionFactory(java.lang.String connectionUri)
Constructor for DriverManagerConnectionFactory.- Parameters:
connectionUri
- a database url of the formjdbc:subprotocol:subname
- Since:
- 2.2
-
DriverManagerConnectionFactory
public DriverManagerConnectionFactory(java.lang.String connectionUri, java.util.Properties properties)
Constructor for DriverManagerConnectionFactory.- Parameters:
connectionUri
- a database url of the formjdbc:subprotocol:subname
properties
- 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 connectionUri, java.lang.String userName, char[] userPassword)
Constructor for DriverManagerConnectionFactory.- Parameters:
connectionUri
- a database url of the formjdbc:subprotocol:subname
userName
- the database useruserPassword
- the user's password
-
DriverManagerConnectionFactory
public DriverManagerConnectionFactory(java.lang.String connectionUri, java.lang.String userName, java.lang.String userPassword)
Constructor for DriverManagerConnectionFactory.- Parameters:
connectionUri
- a database url of the formjdbc:subprotocol:subname
userName
- the database useruserPassword
- 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
-
getConnectionUri
public java.lang.String getConnectionUri()
- Returns:
- The connection URI.
- Since:
- 2.6.0
-
getProperties
public java.util.Properties getProperties()
- Returns:
- The Properties.
- Since:
- 2.6.0
-
getUserName
public java.lang.String getUserName()
- Returns:
- The user name.
- Since:
- 2.6.0
-
-