Class SimpleJdbcConnectionProvider
- java.lang.Object
-
- org.apache.flink.connector.jdbc.internal.connection.SimpleJdbcConnectionProvider
-
- All Implemented Interfaces:
Serializable,JdbcConnectionProvider
@NotThreadSafe public class SimpleJdbcConnectionProvider extends Object implements JdbcConnectionProvider, Serializable
Simple JDBC connection provider.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SimpleJdbcConnectionProvider(JdbcConnectionOptions jdbcOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcloseConnection()Close possible existing connection.ConnectiongetConnection()Get existing connection.ConnectiongetOrEstablishConnection()Get existing connection or establish an new one if there is none.booleanisConnectionValid()Check whether possible existing connection is valid or not throughConnection.isValid(int).ConnectionreestablishConnection()Close possible existing connection and establish an new one.
-
-
-
Constructor Detail
-
SimpleJdbcConnectionProvider
public SimpleJdbcConnectionProvider(JdbcConnectionOptions jdbcOptions)
-
-
Method Detail
-
getConnection
public Connection getConnection()
Description copied from interface:JdbcConnectionProviderGet existing connection.- Specified by:
getConnectionin interfaceJdbcConnectionProvider- Returns:
- existing connection
-
isConnectionValid
public boolean isConnectionValid() throws SQLExceptionDescription copied from interface:JdbcConnectionProviderCheck whether possible existing connection is valid or not throughConnection.isValid(int).- Specified by:
isConnectionValidin interfaceJdbcConnectionProvider- Returns:
- true if existing connection is valid
- Throws:
SQLException- sql exception throw fromConnection.isValid(int)
-
getOrEstablishConnection
public Connection getOrEstablishConnection() throws SQLException, ClassNotFoundException
Description copied from interface:JdbcConnectionProviderGet existing connection or establish an new one if there is none.- Specified by:
getOrEstablishConnectionin interfaceJdbcConnectionProvider- Returns:
- existing connection or newly established connection
- Throws:
SQLException- sql exceptionClassNotFoundException- driver class not found
-
closeConnection
public void closeConnection()
Description copied from interface:JdbcConnectionProviderClose possible existing connection.- Specified by:
closeConnectionin interfaceJdbcConnectionProvider
-
reestablishConnection
public Connection reestablishConnection() throws SQLException, ClassNotFoundException
Description copied from interface:JdbcConnectionProviderClose possible existing connection and establish an new one.- Specified by:
reestablishConnectionin interfaceJdbcConnectionProvider- Returns:
- newly established connection
- Throws:
SQLException- sql exceptionClassNotFoundException- driver class not found
-
-