Stay organized with collections
Save and categorize content based on your preferences.
ConnectionEventListener
interface ConnectionEventListener : EventListener
An object that registers to be notified of events generated by a PooledConnection
object.
The ConnectionEventListener
interface is implemented by a connection pooling component. A connection pooling component will usually be provided by a JDBC driver vendor or another system software vendor. A JDBC driver notifies a ConnectionEventListener
object when an application is finished using a pooled connection with which the listener has registered. The notification occurs after the application calls the method close
on its representation of a PooledConnection
object. A ConnectionEventListener
is also notified when a connection error occurs due to the fact that the PooledConnection
is unfit for future use---the server has crashed, for example. The listener is notified by the JDBC driver just before the driver throws an SQLException
to the application using the PooledConnection
object.
Summary
Public methods |
abstract Unit |
Notifies this ConnectionEventListener that the application has called the method close on its representation of a pooled connection.
|
abstract Unit |
Notifies this ConnectionEventListener that a fatal error has occurred and the pooled connection can no longer be used.
|
Public methods
connectionClosed
abstract fun connectionClosed(event: ConnectionEvent!): Unit
Notifies this ConnectionEventListener
that the application has called the method close
on its representation of a pooled connection.
Parameters |
event |
ConnectionEvent!: an event object describing the source of the event |
connectionErrorOccurred
abstract fun connectionErrorOccurred(event: ConnectionEvent!): Unit
Notifies this ConnectionEventListener
that a fatal error has occurred and the pooled connection can no longer be used. The driver makes this notification just before it throws the application the SQLException
contained in the given ConnectionEvent
object.
Parameters |
event |
ConnectionEvent!: an event object describing the source of the event and containing the SQLException that the driver is about to throw |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ConnectionEventListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nConnectionEventListener\n=======================\n\n```\ninterface ConnectionEventListener : EventListener\n```\n\n|----------------------------------------|\n| [javax.sql.ConnectionEventListener](#) |\n\nAn object that registers to be notified of events generated by a `PooledConnection` object.\n\nThe `ConnectionEventListener` interface is implemented by a connection pooling component. A connection pooling component will usually be provided by a JDBC driver vendor or another system software vendor. A JDBC driver notifies a `ConnectionEventListener` object when an application is finished using a pooled connection with which the listener has registered. The notification occurs after the application calls the method `close` on its representation of a `PooledConnection` object. A `ConnectionEventListener` is also notified when a connection error occurs due to the fact that the `PooledConnection` is unfit for future use---the server has crashed, for example. The listener is notified by the JDBC driver just before the driver throws an `SQLException` to the application using the `PooledConnection` object.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [connectionClosed](#connectionClosed(javax.sql.ConnectionEvent))`(`event:` `[ConnectionEvent](/reference/kotlin/javax/sql/ConnectionEvent)!`)` Notifies this `ConnectionEventListener` that the application has called the method `close` on its representation of a pooled connection. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [connectionErrorOccurred](#connectionErrorOccurred(javax.sql.ConnectionEvent))`(`event:` `[ConnectionEvent](/reference/kotlin/javax/sql/ConnectionEvent)!`)` Notifies this `ConnectionEventListener` that a fatal error has occurred and the pooled connection can no longer be used. |\n\nPublic methods\n--------------\n\n### connectionClosed\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun connectionClosed(event: ConnectionEvent!): Unit\n```\n\nNotifies this `ConnectionEventListener` that the application has called the method `close` on its representation of a pooled connection.\n\n| Parameters ||\n|---------|---------------------------------------------------------------------------------------------------------------------|\n| `event` | [ConnectionEvent](/reference/kotlin/javax/sql/ConnectionEvent)!: an event object describing the source of the event |\n\n### connectionErrorOccurred\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun connectionErrorOccurred(event: ConnectionEvent!): Unit\n```\n\nNotifies this `ConnectionEventListener` that a fatal error has occurred and the pooled connection can no longer be used. The driver makes this notification just before it throws the application the `SQLException` contained in the given `ConnectionEvent` object.\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `event` | [ConnectionEvent](/reference/kotlin/javax/sql/ConnectionEvent)!: an event object describing the source of the event and containing the `SQLException` that the driver is about to throw |"]]