Top Description Methods
com.mysql.cj.jdbc

public Interface ClientInfoProvider

Known Direct Implementers
com.mysql.cj.jdbc.ClientInfoProviderSP, com.mysql.cj.jdbc.CommentClientInfoProvider
Imports
java.sql.Connection, .SQLClientInfoException, .SQLException, java.util.Properties

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 TypeMethod and Description
public void
destroy()

Called once by the driver when the connection this provider instance belongs to is being closed.

public Properties

Returns:

client info as Properties
getClientInfo
(Connection
connection object
conn
)

Returns the client info for the connection that this provider instance belongs to.

public String

Returns:

the client info by given property name
getClientInfo
(Connection
connection object
conn
,
String
property name
name
)

Returns the client info for the connection that this provider instance belongs to.

public void
initialize(Connection
the connection that the provider belongs too.
conn
,
Properties
a java.util.Properties instance that contains configuration information for the connection.
configurationProps
)

Called once by the driver when it needs to configure the provider.

public void
setClientInfo(Connection
connection object
conn
,
Properties
Properties object
properties
)

Sets the client info for the connection that this provider instance belongs to.

public void
setClientInfo(Connection
connection object
conn
,
String
property name
name
,
String
property value
value
)

Sets the client info for the connection that this provider instance belongs to.

Method Detail

destroyback to summary
public void destroy() throws SQLException

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.

Exceptions
SQLException:
if an error occurs.
getClientInfoback to summary
public 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.

Parameters
conn:Connection

connection object

Returns:Properties

client info as Properties

Exceptions
SQLException:
if an error occurs
See Also
java.sql.Connection#getClientInfo()
getClientInfoback to summary
public 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.

Parameters
conn:Connection

connection object

name:String

property name

Returns:String

the client info by given property name

Exceptions
SQLException:
if an error occurs
See Also
java.sql.Connection#getClientInfo(java.lang.String)
initializeback to summary
public void initialize(Connection conn, Properties configurationProps) throws SQLException

Called once by the driver when it needs to configure the provider.

Parameters
conn:Connection

the connection that the provider belongs too.

configurationProps:Properties

a java.util.Properties instance that contains configuration information for the connection.

Exceptions
SQLException:
if initialization fails.
setClientInfoback to summary
public 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.

Parameters
conn:Connection

connection object

properties:Properties

Properties object

Exceptions
SQLClientInfoException:
if an error occurs
See Also
java.sql.Connection#setClientInfo(java.util.Properties)
setClientInfoback to summary
public 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.

Parameters
conn:Connection

connection object

name:String

property name

value:String

property value

Exceptions
SQLClientInfoException:
if an error occurs
See Also
java.sql.Connection#setClientInfo(java.lang.String, java.lang.String)