Class JDBC4CommentClientInfoProvider
java.lang.Object
com.mysql.jdbc.JDBC4CommentClientInfoProvider
- All Implemented Interfaces:
JDBC4ClientInfoProvider
An implementation of JDBC4ClientInfoProvider that exposes the client info as a comment prepended to all statements issued by the driver.
Client information is never read from the server with this implementation, it is always cached locally.
-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
JDBC4CommentClientInfoProvider
public JDBC4CommentClientInfoProvider()
-
-
Method Details
-
initialize
Description copied from interface:JDBC4ClientInfoProviderCalled once by the driver when it needs to configure the provider.- Specified by:
initializein interfaceJDBC4ClientInfoProvider- 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
Description copied from interface:JDBC4ClientInfoProviderCalled 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.- Specified by:
destroyin interfaceJDBC4ClientInfoProvider- Throws:
SQLException- if an error occurs.
-
getClientInfo
Description copied from interface:JDBC4ClientInfoProviderReturns 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.- Specified by:
getClientInfoin interfaceJDBC4ClientInfoProvider- Parameters:
conn-- Returns:
- Throws:
SQLException- See Also:
-
getClientInfo
Description copied from interface:JDBC4ClientInfoProviderReturns 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.- Specified by:
getClientInfoin interfaceJDBC4ClientInfoProvider- Parameters:
conn-- Returns:
- Throws:
SQLException- See Also:
-
setClientInfo
Description copied from interface:JDBC4ClientInfoProviderSets 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.- Specified by:
setClientInfoin interfaceJDBC4ClientInfoProvider- Parameters:
conn-- Throws:
SQLClientInfoException- See Also:
-
setClientInfo
Description copied from interface:JDBC4ClientInfoProviderSets 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.- Specified by:
setClientInfoin interfaceJDBC4ClientInfoProvider- Parameters:
conn-- Throws:
SQLClientInfoException- See Also:
-