Package ch.qos.logback.core.db
Class JNDIConnectionSource
java.lang.Object
ch.qos.logback.core.spi.ContextAwareBase
ch.qos.logback.core.db.ConnectionSourceBase
ch.qos.logback.core.db.JNDIConnectionSource
- All Implemented Interfaces:
ConnectionSource,ContextAware,LifeCycle
The JNDIConnectionSource is an implementation of
ConnectionSource that obtains a DataSource from a
JNDI provider and uses it to obtain a Connection. It is
primarily designed to be used inside of J2EE application servers or
application server clients, assuming the application server supports remote
access of DataSources. In this way one can take advantage
of connection pooling and whatever other goodies the application server
provides.
For more information about this component, please refer to the online manual at http://logback.qos.ch/manual/appenders.html#DBAppender
- Author:
- Ray DeCampo
-
Field Summary
Fields inherited from class ch.qos.logback.core.spi.ContextAwareBase
context -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObtain aConnectionfor use.Returns the jndiLocation.voidsetJndiLocation(String jndiLocation)Sets the jndiLocation.voidstart()Methods inherited from class ch.qos.logback.core.db.ConnectionSourceBase
discoverConnectionProperties, getPassword, getSQLDialectCode, getUser, isStarted, setPassword, setUser, stop, supportsBatchUpdates, supportsGetGeneratedKeysMethods inherited from class ch.qos.logback.core.spi.ContextAwareBase
addError, addError, addInfo, addInfo, addStatus, addWarn, addWarn, getContext, getDeclaredOrigin, getStatusManager, setContext
-
Constructor Details
-
JNDIConnectionSource
public JNDIConnectionSource()
-
-
Method Details
-
start
public void start()- Specified by:
startin interfaceLifeCycle- Overrides:
startin classConnectionSourceBase
-
getConnection
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
-
getJndiLocation
Returns the jndiLocation.- Returns:
- String
-
setJndiLocation
Sets the jndiLocation.- Parameters:
jndiLocation- The jndiLocation to set
-