接口 ClientInfoProvider
-
public interface ClientInfoProviderClasses 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.
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 voiddestroy()Called once by the driver when the connection this provider instance belongs to is being closed.PropertiesgetClientInfo(Connection conn)Returns the client info for the connection that this provider instance belongs to.StringgetClientInfo(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.
-
-
-
方法详细资料
-
initialize
void initialize(Connection conn, Properties configurationProps) throws SQLException
Called once by the driver when it needs to configure the provider.- 参数:
conn- the connection that the provider belongs too.configurationProps- a java.util.Properties instance that contains configuration information for the connection.- 抛出:
SQLException- if initialization fails.
-
destroy
void destroy() throws SQLExceptionCalled 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.- 抛出:
SQLException- if an error occurs.
-
getClientInfo
Properties getClientInfo(Connection conn) throws SQLException
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.- 参数:
conn- connection object- 返回:
- client info as Properties
- 抛出:
SQLException- if an error occurs- 另请参阅:
Connection.getClientInfo()
-
getClientInfo
String getClientInfo(Connection conn, String name) throws SQLException
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.- 参数:
conn- connection objectname- property name- 返回:
- the client info by given property name
- 抛出:
SQLException- if an error occurs- 另请参阅:
Connection.getClientInfo(java.lang.String)
-
setClientInfo
void setClientInfo(Connection conn, Properties properties) throws SQLClientInfoException
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.- 参数:
conn- connection objectproperties- Properties object- 抛出:
SQLClientInfoException- if an error occurs- 另请参阅:
Connection.setClientInfo(java.util.Properties)
-
setClientInfo
void setClientInfo(Connection conn, String name, String value) throws SQLClientInfoException
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.- 参数:
conn- connection objectname- property namevalue- property value- 抛出:
SQLClientInfoException- if an error occurs- 另请参阅:
Connection.setClientInfo(java.lang.String,java.lang.String)
-
-