@NotThreadSafe public class SimpleJdbcConnectionProvider extends Object implements JdbcConnectionProvider, Serializable
| Constructor and Description |
|---|
SimpleJdbcConnectionProvider(JdbcConnectionOptions jdbcOptions) |
| Modifier and Type | Method and Description |
|---|---|
void |
closeConnection()
Close possible existing connection.
|
Connection |
getConnection()
Get existing connection.
|
Connection |
getOrEstablishConnection()
Get existing connection or establish an new one if there is none.
|
boolean |
isConnectionValid()
Check whether possible existing connection is valid or not through
Connection.isValid(int). |
Connection |
reestablishConnection()
Close possible existing connection and establish an new one.
|
public SimpleJdbcConnectionProvider(JdbcConnectionOptions jdbcOptions)
public Connection getConnection()
JdbcConnectionProvidergetConnection in interface JdbcConnectionProviderpublic boolean isConnectionValid()
throws SQLException
JdbcConnectionProviderConnection.isValid(int).isConnectionValid in interface JdbcConnectionProviderSQLException - sql exception throw from Connection.isValid(int)public Connection getOrEstablishConnection() throws SQLException, ClassNotFoundException
JdbcConnectionProvidergetOrEstablishConnection in interface JdbcConnectionProviderSQLException - sql exceptionClassNotFoundException - driver class not foundpublic void closeConnection()
JdbcConnectionProvidercloseConnection in interface JdbcConnectionProviderpublic Connection reestablishConnection() throws SQLException, ClassNotFoundException
JdbcConnectionProviderreestablishConnection in interface JdbcConnectionProviderSQLException - sql exceptionClassNotFoundException - driver class not foundCopyright © 2022–2024 The Apache Software Foundation. All rights reserved.