@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()
JdbcConnectionProvider
getConnection
in interface JdbcConnectionProvider
public boolean isConnectionValid() throws SQLException
JdbcConnectionProvider
Connection.isValid(int)
.isConnectionValid
in interface JdbcConnectionProvider
SQLException
- sql exception throw from Connection.isValid(int)
public Connection getOrEstablishConnection() throws SQLException, ClassNotFoundException
JdbcConnectionProvider
getOrEstablishConnection
in interface JdbcConnectionProvider
SQLException
- sql exceptionClassNotFoundException
- driver class not foundpublic void closeConnection()
JdbcConnectionProvider
closeConnection
in interface JdbcConnectionProvider
public Connection reestablishConnection() throws SQLException, ClassNotFoundException
JdbcConnectionProvider
reestablishConnection
in interface JdbcConnectionProvider
SQLException
- sql exceptionClassNotFoundException
- driver class not foundCopyright © 2014–2023 The Apache Software Foundation. All rights reserved.