ConnectionEvent
Stay organized with collections
Save and categorize content based on your preferences.
An Event
object that provides information about the
source of a connection-related event. ConnectionEvent
objects are generated when an application closes a pooled connection
and when an error occurs. The ConnectionEvent
object
contains two kinds of information:
- The pooled connection closed by the application
- In the case of an error event, the
SQLException
about to be thrown to the application
Public Constructor Summary
Inherited Method Summary
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals( Object obj)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait(long timeout, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long timeout)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
Public Constructors
Constructs a ConnectionEvent
object initialized with
the given PooledConnection
object. SQLException
defaults to null
.
Parameters
con |
the pooled connection that is the source of the event |
Constructs a ConnectionEvent
object initialized with
the given PooledConnection
object and
SQLException
object.
Parameters
con |
the pooled connection that is the source of the event |
ex |
the SQLException about to be thrown to the application |
Public Methods
public
SQLException
getSQLException
()
Retrieves the SQLException
for this
ConnectionEvent
object. May be null
.
Returns
- the SQLException about to be thrown or
null
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\u003eConnectionEvent\u003c/code\u003e objects provide information about connection-related events, such as closing a pooled connection or encountering an error.\u003c/p\u003e\n"],["\u003cp\u003eThese events contain details about the pooled connection and any associated \u003ccode\u003eSQLException\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eConnectionEvent\u003c/code\u003e objects are constructed with a \u003ccode\u003ePooledConnection\u003c/code\u003e object and optionally an \u003ccode\u003eSQLException\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egetSQLException\u003c/code\u003e method retrieves the \u003ccode\u003eSQLException\u003c/code\u003e associated with the event, which may be null.\u003c/p\u003e\n"]]],[],null,["# ConnectionEvent\n\npublic class **ConnectionEvent** extends [EventObject](../../../reference/java/util/EventObject.html) \n\u003cbr /\u003e\n\nAn `Event` object that provides information about the\nsource of a connection-related event. `ConnectionEvent`\nobjects are generated when an application closes a pooled connection\nand when an error occurs. The `ConnectionEvent` object\ncontains two kinds of information:\n\n- The pooled connection closed by the application\n- In the case of an error event, the `SQLException` about to be thrown to the application\n\n\u003cbr /\u003e\n\n### Inherited Field Summary\n\nFrom class [java.util.EventObject](../../../reference/java/util/EventObject.html) \n\n|--------------------------------------------------------------|----------------------------------------------------------------|---------------------------------------------------|\n| protected [Object](../../../reference/java/lang/Object.html) | [source](../../../reference/java/util/EventObject.html#source) | The object on which the Event initially occurred. |\n\n### Public Constructor Summary\n\n|---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| | [ConnectionEvent](../../../reference/javax/sql/ConnectionEvent.html#ConnectionEvent(javax.sql.PooledConnection))([PooledConnection](../../../reference/javax/sql/PooledConnection.html) con) Constructs a `ConnectionEvent` object initialized with the given `PooledConnection` object. |\n| | [ConnectionEvent](../../../reference/javax/sql/ConnectionEvent.html#ConnectionEvent(javax.sql.PooledConnection,%20java.sql.SQLException))([PooledConnection](../../../reference/javax/sql/PooledConnection.html) con, [SQLException](../../../reference/java/sql/SQLException.html) ex) Constructs a `ConnectionEvent` object initialized with the given `PooledConnection` object and `SQLException` object. |\n\n### Public Method Summary\n\n|---------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [SQLException](../../../reference/java/sql/SQLException.html) | [getSQLException](../../../reference/javax/sql/ConnectionEvent.html#getSQLException())() Retrieves the `SQLException` for this `ConnectionEvent` object. |\n\n### Inherited Method Summary\n\nFrom class [java.util.EventObject](../../../reference/java/util/EventObject.html) \n\n|----------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------|\n| [Object](../../../reference/java/lang/Object.html) | [getSource](../../../reference/java/util/EventObject.html#getSource())() The object on which the Event initially occurred. |\n| [String](../../../reference/java/lang/String.html) | [toString](../../../reference/java/util/EventObject.html#toString())() Returns a String representation of this EventObject. |\n\nFrom class [java.lang.Object](../../../reference/java/lang/Object.html) \n\n|-------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Object](../../../reference/java/lang/Object.html) | [clone](../../../reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |\n| boolean | [equals](../../../reference/java/lang/Object.html#equals(java.lang.Object))([Object](../../../reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |\n| void | [finalize](../../../reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |\n| final [Class](../../../reference/java/lang/Class.html)\\\u003c?\\\u003e | [getClass](../../../reference/java/lang/Object.html#getClass())() Returns the unique instance of [Class](../../../reference/java/lang/Class.html) that represents this object's class. |\n| int | [hashCode](../../../reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |\n| final void | [notify](../../../reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |\n| final void | [notifyAll](../../../reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |\n| [String](../../../reference/java/lang/String.html) | [toString](../../../reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |\n| final void | [wait](../../../reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |\n| final void | [wait](../../../reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |\n| final void | [wait](../../../reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |\n\nPublic Constructors\n-------------------\n\n#### public\n**ConnectionEvent**\n([PooledConnection](../../../reference/javax/sql/PooledConnection.html) con)\n\n\u003cbr /\u003e\n\nConstructs a `ConnectionEvent` object initialized with\nthe given `PooledConnection` object. `SQLException`\ndefaults to `null`. \n\n##### Parameters\n\n| con | the pooled connection that is the source of the event |\n|-----|-------------------------------------------------------|\n\n##### Throws\n\n| [IllegalArgumentException](../../../reference/java/lang/IllegalArgumentException.html) | if `con` is null. |\n|----------------------------------------------------------------------------------------|-------------------|\n\n#### public\n**ConnectionEvent**\n([PooledConnection](../../../reference/javax/sql/PooledConnection.html) con, [SQLException](../../../reference/java/sql/SQLException.html) ex)\n\n\u003cbr /\u003e\n\nConstructs a `ConnectionEvent` object initialized with\nthe given `PooledConnection` object and\n`SQLException` object. \n\n##### Parameters\n\n| con | the pooled connection that is the source of the event |\n| ex | the SQLException about to be thrown to the application |\n|-----|--------------------------------------------------------|\n\n##### Throws\n\n| [IllegalArgumentException](../../../reference/java/lang/IllegalArgumentException.html) | if `con` is null. |\n|----------------------------------------------------------------------------------------|-------------------|\n\nPublic Methods\n--------------\n\n#### public [SQLException](../../../reference/java/sql/SQLException.html)\n**getSQLException**\n()\n\n\u003cbr /\u003e\n\nRetrieves the `SQLException` for this\n`ConnectionEvent` object. May be `null`. \n\n##### Returns\n\n- the SQLException about to be thrown or `null`"]]