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 of
ConnectionSource
that obtains the Connection in the recommended JDBC manner based on
a DataSource
.
-
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
Obtain aConnection
for use.boolean
parseUnrecognizedElement
(Element element, Properties props) void
setDataSource
(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
-
Field Details
-
dataSource
-
-
Constructor Details
-
DataSourceConnectionSource
public DataSourceConnectionSource()
-
-
Method Details
-
activateOptions
public void activateOptions()- Specified by:
activateOptions
in interfaceorg.apache.log4j.spi.OptionHandler
-
getConnection
Description copied from interface:ConnectionSource
Obtain aConnection
for use. The client is responsible for closing theConnection
when it is no longer required.- Specified by:
getConnection
in interfaceConnectionSource
- Throws:
SQLException
- if aConnection
could not be obtained- See Also:
-
getDataSource
-
setDataSource
-
parseUnrecognizedElement
- Specified by:
parseUnrecognizedElement
in interfaceorg.apache.log4j.xml.UnrecognizedElementHandler
- Throws:
Exception
-