Package ch.qos.logback.core.db
Class DriverManagerConnectionSource
- java.lang.Object
-
- ch.qos.logback.core.spi.ContextAwareBase
-
- ch.qos.logback.core.db.ConnectionSourceBase
-
- ch.qos.logback.core.db.DriverManagerConnectionSource
-
- All Implemented Interfaces:
ConnectionSource,ContextAware,LifeCycle
public class DriverManagerConnectionSource extends ConnectionSourceBase
The DriverManagerConnectionSource is an implementation ofConnectionSourcethat obtains the Connection in the traditional JDBC manner based on the connection URL.For more information about this component, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#DBAppender
-
-
Constructor Summary
Constructors Constructor Description DriverManagerConnectionSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectiongetConnection()Obtain aConnectionfor use.StringgetDriverClass()Returns the name of the driver class.StringgetUrl()Returns the url.voidsetDriverClass(String driverClass)Sets the driver class.voidsetUrl(String url)Sets the url.voidstart()-
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, getStatusManager, setContext
-
-
-
-
Method Detail
-
start
public void start()
- Specified by:
startin interfaceLifeCycle- Overrides:
startin classConnectionSourceBase
-
getConnection
public Connection getConnection() throws SQLException
Description copied from interface:ConnectionSourceObtain aConnectionfor use. The client is responsible for closing theConnectionwhen it is no longer required.- Throws:
SQLException- if aConnectioncould not be obtained- See Also:
ConnectionSource.getConnection()
-
getUrl
public String getUrl()
Returns the url.- Returns:
- String
-
setUrl
public void setUrl(String url)
Sets the url.- Parameters:
url- The url to set
-
getDriverClass
public String getDriverClass()
Returns the name of the driver class.- Returns:
- String
-
setDriverClass
public void setDriverClass(String driverClass)
Sets the driver class.- Parameters:
driverClass- The driver class to set
-
-