ConnectionEventListener
Stay organized with collections
Save and categorize content based on your preferences.
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.
Public Method Summary
abstract
void
|
connectionClosed( ConnectionEvent event)
Notifies this ConnectionEventListener that
the application has called the method close on its
representation of a pooled connection.
|
abstract
void
|
|
Public Methods
public
abstract
void
connectionClosed
(ConnectionEvent event)
Notifies this ConnectionEventListener
that
the application has called the method close
on its
representation of a pooled connection.
Parameters
event |
an event object describing the source of
the event
|
public
abstract
void
connectionErrorOccurred
(ConnectionEvent event)
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 |
an event object describing the source of
the event and containing the SQLException that the
driver is about to throw
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-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 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eConnectionEventListener\u003c/code\u003e is an interface in Java that gets notified about events related to \u003ccode\u003ePooledConnection\u003c/code\u003e objects.\u003c/p\u003e\n"],["\u003cp\u003eIt is implemented by connection pooling components to manage the lifecycle of pooled connections.\u003c/p\u003e\n"],["\u003cp\u003eThis listener gets notified when an application closes a pooled connection or when a fatal error occurs.\u003c/p\u003e\n"],["\u003cp\u003eThere are two key methods: \u003ccode\u003econnectionClosed()\u003c/code\u003e is called when an application closes a pooled connection and \u003ccode\u003econnectionErrorOccurred()\u003c/code\u003e is called when a fatal error occurs making the connection unusable.\u003c/p\u003e\n"]]],["`ConnectionEventListener` is an interface implemented by connection pooling components, typically provided by JDBC drivers. It allows notification of events related to `PooledConnection` objects. The listener is notified when an application closes a pooled connection via the `connectionClosed` method, and when a fatal error occurs rendering the pooled connection unusable, via the `connectionErrorOccurred` method. These notifications are triggered by the JDBC driver and provide information about the event or the thrown `SQLException`.\n"],null,["public interface **ConnectionEventListener** implements [EventListener](../../../reference/java/util/EventListener.html) \n\u003cbr /\u003e\n\n\nAn object that registers to be notified of events generated by a\n`PooledConnection` object.\n\n\nThe `ConnectionEventListener` interface is implemented by a\nconnection pooling component. A connection pooling component will\nusually be provided by a JDBC driver vendor or another system software\nvendor. A JDBC driver notifies a `ConnectionEventListener`\nobject when an application is finished using a pooled connection with\nwhich the listener has registered. The notification\noccurs after the application calls the method `close` on\nits representation of a `PooledConnection` object. A\n`ConnectionEventListener` is also notified when a\nconnection error occurs due to the fact that the `PooledConnection`\nis unfit for future use---the server has crashed, for example.\nThe listener is notified by the JDBC driver just before the driver throws an\n`SQLException` to the application using the\n`PooledConnection` object. \n\nPublic Method Summary\n\n|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [connectionClosed](../../../reference/javax/sql/ConnectionEventListener.html#connectionClosed(javax.sql.ConnectionEvent))([ConnectionEvent](../../../reference/javax/sql/ConnectionEvent.html) event) Notifies this `ConnectionEventListener` that the application has called the method `close` on its representation of a pooled connection. |\n| abstract void | [connectionErrorOccurred](../../../reference/javax/sql/ConnectionEventListener.html#connectionErrorOccurred(javax.sql.ConnectionEvent))([ConnectionEvent](../../../reference/javax/sql/ConnectionEvent.html) event) Notifies this `ConnectionEventListener` that a fatal error has occurred and the pooled connection can no longer be used. |\n\nPublic Methods \n\npublic abstract void\n**connectionClosed**\n([ConnectionEvent](../../../reference/javax/sql/ConnectionEvent.html) event) \nNotifies this `ConnectionEventListener` that\nthe application has called the method `close` on its\nrepresentation of a pooled connection. \n\nParameters\n\n| event | an event object describing the source of the event |\n|-------|----------------------------------------------------|\n\npublic abstract void\n**connectionErrorOccurred**\n([ConnectionEvent](../../../reference/javax/sql/ConnectionEvent.html) event) \nNotifies this `ConnectionEventListener` that\na fatal error has occurred and the pooled connection can\nno longer be used. The driver makes this notification just\nbefore it throws the application the `SQLException`\ncontained in the given `ConnectionEvent` object. \n\nParameters\n\n| event | an event object describing the source of the event and containing the `SQLException` that the driver is about to throw |\n|-------|------------------------------------------------------------------------------------------------------------------------|"]]