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
public class JNDIConnectionSource extends ConnectionSourceBase
TheJNDIConnectionSource is an implementation ofConnectionSourcethat obtains aDataSourcefrom a JNDI provider and uses it to obtain aConnection. It is primarily designed to be used inside of J2EE application servers or application server clients, assuming the application server supports remote access ofDataSources. 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
-
-
Constructor Summary
Constructors Constructor Description JNDIConnectionSource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.sql.ConnectiongetConnection()Obtain aConnectionfor use.java.lang.StringgetJndiLocation()Returns the jndiLocation.voidsetJndiLocation(java.lang.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, 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 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.- Throws:
java.sql.SQLException- if aConnectioncould not be obtained
-
getJndiLocation
public java.lang.String getJndiLocation()
Returns the jndiLocation.- Returns:
- String
-
setJndiLocation
public void setJndiLocation(java.lang.String jndiLocation)
Sets the jndiLocation.- Parameters:
jndiLocation- The jndiLocation to set
-
-