@ComponentProfile(summary="Connect to a database using a JDBC driver", tag="connections,jdbc") public class JdbcConnection extends DatabaseConnection
Implementation of AdaptrisConnectionImp
for JDBC.
In the adapter configuration file this class is aliased as jdbc-connection which is the preferred alternative to the fully qualified classname when building your configuration.
log
Constructor and Description |
---|
JdbcConnection() |
JdbcConnection(java.lang.String url,
java.lang.String driver)
Convenience constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
closeDatabaseConnection()
Initialise the underlying database connection.
|
boolean |
equals(java.lang.Object o)
Force implementations to over-ride equals with a semantic implementation.
|
protected java.lang.String |
getConnectionName()
Returns a name for this connection for logging purposes.
|
java.lang.String |
getConnectUrl()
Returns the connection string to use for this JDBC source.
|
int |
hashCode()
Force implementations to over-ride hashcode.
|
protected void |
initialiseDatabaseConnection()
Initialise the underlying database connection.
|
protected java.sql.Connection |
makeConnection()
Make the connection.
|
void |
setConnectUrl(java.lang.String s)
Sets the connection string to use for this JDBC source.
|
protected void |
startDatabaseConnection()
Initialise the underlying database connection.
|
protected void |
stopDatabaseConnection()
Initialise the underlying database connection.
|
alwaysValidateConnection, asDataSource, autoCommit, checkInternalState, closeConnection, connect, connectionProperties, debugMode, getAlwaysValidateConnection, getAutoCommit, getConnectionProperties, getDebugMode, getDriverImp, getPassword, getTestStatement, getUsername, initConnection, prepareConnection, setAlwaysValidateConnection, setAutoCommit, setConnectionProperties, setDebugMode, setDriverImp, setPassword, setTestStatement, setUsername, startConnection, stopConnection
connectionAttempts, connectionRetryInterval, createLoggingStatement, getConnectionAttempts, getConnectionRetryInterval, logWarning, setConnectionAttempts, setConnectionRetryInterval
addExceptionListener, addMessageConsumer, addMessageProducer, changeState, cloneForTesting, close, connectionErrorHandler, getConnectionErrorHandler, getUniqueId, getWorkersFirstOnShutdown, init, prepare, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, retrieveConnection, retrieveExceptionListeners, retrieveMessageConsumers, retrieveMessageProducers, setConnectionErrorHandler, setUniqueId, setWorkersFirstOnShutdown, start, stop, workersFirstOnShutdown
public JdbcConnection()
public JdbcConnection(java.lang.String url, java.lang.String driver)
url
- the URL.driver
- the JDBC driver.protected void initialiseDatabaseConnection() throws CoreException
DatabaseConnection
Initialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to initialise any components other than the DriverManager.
initialiseDatabaseConnection
in class DatabaseConnection
CoreException
- wrapping any underlying exception.DatabaseConnection.initialiseDatabaseConnection()
protected void startDatabaseConnection() throws CoreException
DatabaseConnection
Initialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to initialise any components other than the DriverManager.
startDatabaseConnection
in class DatabaseConnection
CoreException
- wrapping any underlying exception.DatabaseConnection.startDatabaseConnection()
protected void stopDatabaseConnection()
DatabaseConnection
Initialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to stop any components other than the DriverManager.
stopDatabaseConnection
in class DatabaseConnection
DatabaseConnection.stopDatabaseConnection()
protected void closeDatabaseConnection()
DatabaseConnection
Initialise the underlying database connection.
This abstract method should be implemented by concrete sub-classes to close any components.
closeDatabaseConnection
in class DatabaseConnection
protected java.sql.Connection makeConnection() throws java.sql.SQLException
DatabaseConnection
Make the connection.
This abstract method should be implemented by concrete sub-classes to make or check the current connection to the Jdbc source.
makeConnection
in class DatabaseConnection
java.sql.SQLException
- if the connection could not be made.DatabaseConnection.makeConnection()
public java.lang.String getConnectUrl()
Returns the connection string to use for this JDBC source.
public void setConnectUrl(java.lang.String s)
Sets the connection string to use for this JDBC source.
s
- the connection string to use for this JDBC sourcepublic boolean equals(java.lang.Object o)
DatabaseConnection
Force implementations to over-ride equals with a semantic implementation.
equals
in class DatabaseConnection
Object.equals(java.lang.Object)
public int hashCode()
DatabaseConnection
Force implementations to over-ride hashcode.
hashCode
in class DatabaseConnection
Object.hashCode()
protected java.lang.String getConnectionName()
DatabaseConnection
Returns a name for this connection for logging purposes.
getConnectionName
in class DatabaseConnection
DatabaseConnection.getConnectionName()