ch.qos.logback.core.db

## Class DataSourceConnectionSource

- java.lang.Object
- - ch.qos.logback.core.spi.ContextAwareBase
  - - ch.qos.logback.core.db.ConnectionSourceBase
    - - ch.qos.logback.core.db.DataSourceConnectionSource

All Implemented Interfaces:
  ConnectionSource, ContextAware, LifeCycle

    public class DataSourceConnectionSource
    extends ConnectionSourceBase

The DataSourceConnectionSource is an implementation of `ConnectionSource` that obtains the Connection in the recommended JDBC manner based on a `DataSource`.

For more information about this component, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#DBAppender

Author:
  Ray DeCampo, Ceki Gülcü

### Field Summary

### Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase

`context`

### Constructor Summary

Constructors
Constructor and Description
`DataSourceConnectionSource()`

### Method Summary

Methods
`java.sql.Connection` `getConnection()` Obtain a `Connection` for use.
`javax.sql.DataSource` `getDataSource()`
`void` `setDataSource(javax.sql.DataSource dataSource)`
`void` `start()`

### Methods inherited from class ch.qos.logback.core.db.ConnectionSourceBase

`discoverConnectionProperties, getPassword, getSQLDialectCode, getUser, isStarted, setPassword, setUser, stop, supportsBatchUpdates, supportsGetGeneratedKeys`

### Methods inherited from class ch.qos.logback.core.spi.ContextAwareBase

`addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext`

### Methods inherited from class java.lang.Object

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

### Constructor Detail

#### DataSourceConnectionSource

    public DataSourceConnectionSource()

### Method Detail

#### start

    public void start()

Specified by:
  `start` in interface `LifeCycle`
Overrides:
  `start` in class `ConnectionSourceBase`

#### getConnection

    public java.sql.Connection getConnection()
                                      throws java.sql.SQLException

Description copied from interface: `ConnectionSource`
Obtain a `Connection` for use. The client is responsible for closing the `Connection` when it is no longer required.

Throws:
  `java.sql.SQLException` - if a `Connection` could not be obtained
See Also:
  `ConnectionSource.getConnection()`

#### getDataSource

    public javax.sql.DataSource getDataSource()

#### setDataSource

    public void setDataSource(javax.sql.DataSource dataSource)