Package org.apache.log4j.db
Class DataSourceConnectionSource
- java.lang.Object
-
- org.apache.log4j.spi.ComponentBase
-
- org.apache.log4j.db.ConnectionSourceSkeleton
-
- org.apache.log4j.db.DataSourceConnectionSource
-
- All Implemented Interfaces:
ConnectionSource,Component,org.apache.log4j.spi.OptionHandler,org.apache.log4j.xml.UnrecognizedElementHandler
public class DataSourceConnectionSource extends ConnectionSourceSkeleton implements org.apache.log4j.xml.UnrecognizedElementHandler
The DataSourceConnectionSource is an implementation ofConnectionSourcethat obtains the Connection in the recommended JDBC manner based on aDataSource.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.sql.DataSourcedataSource-
Fields inherited from class org.apache.log4j.spi.ComponentBase
repository
-
Fields inherited from interface org.apache.log4j.db.ConnectionSource
HSQL_DIALECT, MSSQL_DIALECT, MYSQL_DIALECT, ORACLE_DIALECT, POSTGRES_DIALECT, UNKNOWN_DIALECT
-
-
Constructor Summary
Constructors Constructor Description DataSourceConnectionSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateOptions()java.sql.ConnectiongetConnection()Obtain aConnectionfor use.javax.sql.DataSourcegetDataSource()booleanparseUnrecognizedElement(org.w3c.dom.Element element, java.util.Properties props)voidsetDataSource(javax.sql.DataSource dataSource)-
Methods inherited from class org.apache.log4j.db.ConnectionSourceSkeleton
discoverConnnectionProperties, getOverriddenSupportsGetGeneratedKeys, getPassword, getSQLDialectCode, getUser, setOverriddenSupportsGetGeneratedKeys, setPassword, setUser, supportsBatchUpdates, supportsGetGeneratedKeys
-
Methods inherited from class org.apache.log4j.spi.ComponentBase
getLogger, getLoggerRepository, getNonFloodingLogger, resetErrorCount, setLoggerRepository
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.log4j.spi.Component
setLoggerRepository
-
-
-
-
Method Detail
-
activateOptions
public void activateOptions()
- Specified by:
activateOptionsin interfaceorg.apache.log4j.spi.OptionHandler
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLExceptionDescription copied from interface:ConnectionSourceObtain aConnectionfor use. The client is responsible for closing theConnectionwhen it is no longer required.- Specified by:
getConnectionin interfaceConnectionSource- Throws:
java.sql.SQLException- if aConnectioncould not be obtained- See Also:
ConnectionSource.getConnection()
-
getDataSource
public javax.sql.DataSource getDataSource()
-
setDataSource
public void setDataSource(javax.sql.DataSource dataSource)
-
parseUnrecognizedElement
public boolean parseUnrecognizedElement(org.w3c.dom.Element element, java.util.Properties props) throws java.lang.Exception- Specified by:
parseUnrecognizedElementin interfaceorg.apache.log4j.xml.UnrecognizedElementHandler- Throws:
java.lang.Exception
-
-