Class JNDIConnectionSource

  • All Implemented Interfaces:
    ConnectionSource, ContextAware, LifeCycle

    public class JNDIConnectionSource
    extends ConnectionSourceBase
    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

    • Constructor Detail

      • JNDIConnectionSource

        public JNDIConnectionSource()
    • Method Detail

      • getConnection

        public java.sql.Connection getConnection()
                                          throws java.sql.SQLException
        Description copied from interface: ConnectionSource
        Obtain a Connection for use. The client is responsible for closing the Connection when it is no longer required.
        Throws:
        java.sql.SQLException - if a Connection could 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