Class DataSourceConnectionFactory
java.lang.Object
org.apache.tomcat.dbcp.dbcp2.DataSourceConnectionFactory
- All Implemented Interfaces:
ConnectionFactory
A
DataSource
-based implementation of ConnectionFactory
.- Since:
- 2.0
-
Constructor Summary
ConstructorDescriptionDataSourceConnectionFactory
(DataSource dataSource) Constructs an instance for the given DataSource.DataSourceConnectionFactory
(DataSource dataSource, String userName, char[] userPassword) Constructs an instance for the given DataSource.DataSourceConnectionFactory
(DataSource dataSource, String userName, String password) Constructs an instance for the given DataSource. -
Method Summary
Modifier and TypeMethodDescriptionCreate a newConnection
in an implementation specific fashion.char[]
-
Constructor Details
-
DataSourceConnectionFactory
Constructs an instance for the given DataSource.- Parameters:
dataSource
- The DataSource for this factory.
-
DataSourceConnectionFactory
Constructs an instance for the given DataSource.- Parameters:
dataSource
- The DataSource for this factory.userName
- The user name.userPassword
- The user password.- Since:
- 2.4.0
-
DataSourceConnectionFactory
Constructs an instance for the given DataSource.- Parameters:
dataSource
- The DataSource for this factory.userName
- The user name.password
- The user 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
-
getDataSource
- Returns:
- The data source.
- Since:
- 2.6.0
-
getUserName
- Returns:
- The user name.
- Since:
- 2.6.0
-
getUserPassword
public char[] getUserPassword()- Returns:
- The user password.
- Since:
- 2.6.0
-