Class DataSourceConnectionSource

All Implemented Interfaces:
ConnectionSource, LifeCycle, LifeCycle2

@Plugin(name="DataSource", category="Core", elementType="connectionSource", printObject=true) public final class DataSourceConnectionSource extends AbstractConnectionSource
A JdbcAppender connection source that uses a DataSource to connect to the database.
  • Method Details

    • getConnection

      public Connection getConnection() throws SQLException
      Description copied from interface: ConnectionSource
      This should return a new connection every time it is called.
      the SQL connection object.
      SQLException - if a database error occurs.
    • toString

      public String toString()
      Description copied from interface: ConnectionSource
      All implementations must override Object.toString() to provide information about the connection configuration (obscuring passwords with one-way hashes).
      Specified by:
      toString in interface ConnectionSource
      toString in class Object
      the string representation of this connection source.
    • createConnectionSource

      @PluginFactory public static DataSourceConnectionSource createConnectionSource(@PluginAttribute("jndiName") String jndiName)
      Factory method for creating a connection source within the plugin manager.
      jndiName - The full JNDI path where the data source is bound. Must start with java:/comp/env or environment-equivalent.
      the created connection source.