# ConnectionEvent

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Inherited Fields](https://developer.android.com/reference/javax/sql/ConnectionEvent#inhfields)\|[Ctors](https://developer.android.com/reference/javax/sql/ConnectionEvent#pubctors)\|[Methods](https://developer.android.com/reference/javax/sql/ConnectionEvent#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/javax/sql/ConnectionEvent#inhmethods)  

# ConnectionEvent

`
public


class
ConnectionEvent
`  
`


``

extends `[EventObject](https://developer.android.com/reference/java/util/EventObject)`


``


`

|---|---|---------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [java.util.EventObject](https://developer.android.com/reference/java/util/EventObject) ||
|   | ↳ | javax.sql.ConnectionEvent |

<br />

*** ** * ** ***

<br />

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

<br />

## Summary

|                                                                                                                                                                                                                                                              ### Inherited fields                                                                                                                                                                                                                                                              |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From class[java.util.EventObject](https://developer.android.com/reference/java/util/EventObject) |---------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------| | ` protected `[Object](https://developer.android.com/reference/java/lang/Object) | [source](https://developer.android.com/reference/java/util/EventObject#source) The object on which the Event initially occurred. | |

|                                                                                                                                                                                                                           ### Public constructors                                                                                                                                                                                                                           ||
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[ConnectionEvent](https://developer.android.com/reference/javax/sql/ConnectionEvent#ConnectionEvent(javax.sql.PooledConnection))`(`[PooledConnection](https://developer.android.com/reference/javax/sql/PooledConnection)` con) ` <br /> Constructs a`ConnectionEvent`object initialized with the given`PooledConnection`object.                                                                                                                                      |
| ` `[ConnectionEvent](https://developer.android.com/reference/javax/sql/ConnectionEvent#ConnectionEvent(javax.sql.PooledConnection,%20java.sql.SQLException))`(`[PooledConnection](https://developer.android.com/reference/javax/sql/PooledConnection)` con, `[SQLException](https://developer.android.com/reference/java/sql/SQLException)` ex) ` <br /> Constructs a`ConnectionEvent`object initialized with the given`PooledConnection`object and`SQLException`object. |

|                                                                                                                         ### Public methods                                                                                                                          ||
|----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[SQLException](https://developer.android.com/reference/java/sql/SQLException) | ` `[getSQLException](https://developer.android.com/reference/javax/sql/ConnectionEvent#getSQLException())`() ` <br /> Retrieves the`SQLException`for this`ConnectionEvent`object. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.util.EventObject](https://developer.android.com/reference/java/util/EventObject)` ` |-----------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object) | ` `[getSource](https://developer.android.com/reference/java/util/EventObject#getSource())`() ` The object on which the Event initially occurred.  | | ` `[String](https://developer.android.com/reference/java/lang/String) | ` `[toString](https://developer.android.com/reference/java/util/EventObject#toString())`() ` Returns a String representation of this EventObject. | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### ConnectionEvent

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ConnectionEvent (PooledConnection con)
```

<br />

Constructs a`ConnectionEvent`object initialized with the given`PooledConnection`object.`SQLException`defaults to`null`.

<br />

|                                       Parameters                                        ||
|-------|----------------------------------------------------------------------------------|
| `con` | `PooledConnection`: the pooled connection that is the source of the event <br /> |

|                                                         Throws                                                          ||
|--------------------------------------------------------------------------------------------------------|-----------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if`con`is null. |

### ConnectionEvent

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public ConnectionEvent (PooledConnection con, 
                SQLException ex)
```

<br />

Constructs a`ConnectionEvent`object initialized with the given`PooledConnection`object and`SQLException`object.

<br />

|                                       Parameters                                        ||
|-------|----------------------------------------------------------------------------------|
| `con` | `PooledConnection`: the pooled connection that is the source of the event <br /> |
| `ex`  | `SQLException`: the SQLException about to be thrown to the application <br />    |

|                                                         Throws                                                          ||
|--------------------------------------------------------------------------------------------------------|-----------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if`con`is null. |

## Public methods

### getSQLException

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public SQLException getSQLException ()
```

<br />

Retrieves the`SQLException`for this`ConnectionEvent`object. May be`null`.

<br />

|                                                              Returns                                                               ||
|-------------------------------------------------------------------------------|-----------------------------------------------------|
| [SQLException](https://developer.android.com/reference/java/sql/SQLException) | the SQLException about to be thrown or`null` <br /> |