ConnectionSource
, LifeCycle
, LifeCycle2
@Plugin(name="DataSource", category="Core", elementType="connectionSource", printObject=true) public final class DataSourceConnectionSource extends AbstractConnectionSource
JdbcAppender
connection source that uses a DataSource
to connect to the database.LifeCycle.State
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT
Modifier and Type | Method | Description |
---|---|---|
static DataSourceConnectionSource |
createConnectionSource(String jndiName) |
Factory method for creating a connection source within the plugin manager.
|
Connection |
getConnection() |
This should return a new connection every time it is called.
|
String |
toString() |
All implementations must override
Object.toString() to provide information about the connection
configuration (obscuring passwords with one-way hashes). |
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop, stop, stop
public Connection getConnection() throws SQLException
ConnectionSource
SQLException
- if a database error occurs.public String toString()
ConnectionSource
Object.toString()
to provide information about the connection
configuration (obscuring passwords with one-way hashes).toString
in interface ConnectionSource
toString
in class Object
@PluginFactory public static DataSourceConnectionSource createConnectionSource(@PluginAttribute("jndiName") String jndiName)
jndiName
- The full JNDI path where the data source is bound. Should start with java:/comp/env or
environment-equivalent.Copyright © 1999-2018. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.