Interface JDBC4ClientInfoProvider
- All Known Implementing Classes:
JDBC4ClientInfoProviderSP, JDBC4CommentClientInfoProvider
public interface JDBC4ClientInfoProvider
Classes that implement this interface and provide a no-args constructor can be used by the driver to store and retrieve client information and/or labels.
The driver will create an instance for each Connection instance, and call initialize() once and only once. When the connection is closed, destroy() will be
called, and the provider is expected to clean up any resources at this time.
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Called once by the driver when the connection this provider instance belongs to is being closed.getClientInfo(Connection conn) Returns the client info for the connection that this provider instance belongs to.getClientInfo(Connection conn, String name) Returns the client info for the connection that this provider instance belongs to.voidinitialize(Connection conn, Properties configurationProps) Called once by the driver when it needs to configure the provider.voidsetClientInfo(Connection conn, String name, String value) Sets the client info for the connection that this provider instance belongs to.voidsetClientInfo(Connection conn, Properties properties) Sets the client info for the connection that this provider instance belongs to.
-
Method Details
-
initialize
Called once by the driver when it needs to configure the provider.- Parameters:
conn- the connection that the provider belongs too.configurationProps- a java.util.Properties instance that contains configuration information for the connection.- Throws:
SQLException- if initialization fails.
-
destroy
Called once by the driver when the connection this provider instance belongs to is being closed. Implementations are expected to clean up and resources at this point in time.- Throws:
SQLException- if an error occurs.
-
getClientInfo
Returns the client info for the connection that this provider instance belongs to. The connection instance is passed as an argument for convenience's sake. Providers can use the connection to communicate with the database, but it will be within the scope of any ongoing transactions, so therefore implementations should not attempt to change isolation level, autocommit settings or call rollback() or commit() on the connection.- Parameters:
conn-- Returns:
- Throws:
SQLException- See Also:
-
getClientInfo
Returns the client info for the connection that this provider instance belongs to. The connection instance is passed as an argument for convenience's sake. Providers can use the connection to communicate with the database, but it will be within the scope of any ongoing transactions, so therefore implementations should not attempt to change isolation level, autocommit settings or call rollback() or commit() on the connection.- Parameters:
conn-- Returns:
- Throws:
SQLException- See Also:
-
setClientInfo
Sets the client info for the connection that this provider instance belongs to. The connection instance is passed as an argument for convenience's sake. Providers can use the connection to communicate with the database, but it will be within the scope of any ongoing transactions, so therefore implementations should not attempt to change isolation level, autocommit settings or call rollback() or commit() on the connection.- Parameters:
conn-- Throws:
SQLExceptionSQLClientInfoException- See Also:
-
setClientInfo
Sets the client info for the connection that this provider instance belongs to. The connection instance is passed as an argument for convenience's sake. Providers can use the connection to communicate with the database, but it will be within the scope of any ongoing transactions, so therefore implementations should not attempt to change isolation level, autocommit settings or call rollback() or commit() on the connection.- Parameters:
conn-- Throws:
SQLExceptionSQLClientInfoException- See Also:
-