# Class DriverConnectionFactory

java.lang.Object
org.apache.tomcat.dbcp.dbcp2.DriverConnectionFactory

All Implemented Interfaces:
  `ConnectionFactory`

public class DriverConnectionFactory extends Object implements ConnectionFactory
A `Driver`-based implementation of `ConnectionFactory`.

Since:
  2.0

## Constructor Summary

Constructors
Constructor
Description
`DriverConnectionFactory(Driver driver, String connectString, Properties properties)`
Constructs a connection factory for a given Driver.

## Method Summary

Modifier and Type
Method
Description
`Connection`
`createConnection()`
Create a new `Connection` in an implementation specific fashion.
`String`
`getConnectionString()`
Gets the connection String.
`Driver`
`getDriver()`
Gets the JDBC Driver.
`Properties`
`getProperties()`
Gets the properties.
`String`
`toString()`

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### DriverConnectionFactory

public DriverConnectionFactory(Driver driver, String connectString, Properties properties)
Constructs a connection factory for a given Driver.

Parameters:
  `driver` - The Driver.
  `connectString` - The connection string.
  `properties` - The connection properties.

## Method Details

### createConnection

public Connection createConnection() throws SQLException
Description copied from interface: `ConnectionFactory`
Create a new `Connection` in an implementation specific fashion.

Specified by:
  `createConnection` in interface `ConnectionFactory`
Returns:
  a new `Connection`
Throws:
  `SQLException` - if a database error occurs creating the connection

### getConnectionString

public String getConnectionString()
Gets the connection String.

Returns:
  The connection String.
Since:
  2.6.0

### getDriver

public Driver getDriver()
Gets the JDBC Driver.

Returns:
  The JDBC Driver.
Since:
  2.6.0

### getProperties

public Properties getProperties()
Gets the properties.

Returns:
  The properties.
Since:
  2.6.0

### toString

public String toString()

Overrides:
  `toString` in class `Object`