public class AbstractDriverManagerConnectionSource extends AbstractConnectionSource
ConnectionSource that uses a JDBC connection string, a user name, and a password to call
DriverManager.getConnection(String, String, String).
This plugin does not provide any connection pooling unless it is available through the connection string and driver itself. This handy to get you off the ground without having to deal with JNDI.
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractDriverManagerConnectionSource.Builder<B extends AbstractDriverManagerConnectionSource.Builder<B>>
Builds DriverManagerConnectionSource instances.
|
LifeCycle.StateDEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT| Constructor and Description |
|---|
AbstractDriverManagerConnectionSource(String driverClassName,
String connectionString,
String actualConnectionString,
char[] userName,
char[] password,
Property[] properties) |
| Modifier and Type | Method and Description |
|---|---|
String |
getActualConnectionString() |
Connection |
getConnection()
This should return a new connection every time it is called.
|
String |
getConnectionString() |
String |
getDriverClassName() |
static org.apache.logging.log4j.Logger |
getLogger() |
char[] |
getPassword() |
Property[] |
getProperties() |
char[] |
getUserName() |
protected void |
loadDriver() |
protected void |
loadDriver(String className)
Loads a JDBC driver for the given class name
|
protected Properties |
toProperties(Property[] properties) |
String |
toString()
All implementations must override
Object.toString() to provide information about the connection
configuration (obscuring passwords with one-way hashes). |
protected String |
toString(char[] value) |
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop, stop, stoppublic AbstractDriverManagerConnectionSource(String driverClassName, String connectionString, String actualConnectionString, char[] userName, char[] password, Property[] properties)
public static org.apache.logging.log4j.Logger getLogger()
public String getActualConnectionString()
public Connection getConnection() throws SQLException
ConnectionSourceSQLException - if a database error occurs.public String getConnectionString()
public String getDriverClassName()
public char[] getPassword()
public Property[] getProperties()
public char[] getUserName()
protected void loadDriver() throws SQLException
SQLExceptionprotected void loadDriver(String className) throws SQLException
className - the fully-qualified class name for a JDBC Driver.SQLException - thrown when loading the driver throws an exception.protected Properties toProperties(Property[] properties)
public String toString()
ConnectionSourceObject.toString() to provide information about the connection
configuration (obscuring passwords with one-way hashes).toString in interface ConnectionSourcetoString in class ObjectCopyright © 1999-2021 The Apache Software Foundation. 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.