FileDocCategorySizeDatePackage
ConnectionEvent.javaAPI DocJava SE 6 API2410Tue Jun 10 00:26:32 BST 2008javax.sql

ConnectionEvent

public class ConnectionEvent extends EventObject

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
since
1.4

Fields Summary
private SQLException
ex
The SQLException that the driver will throw to the application when an error occurs and the pooled connection is no longer usable.
static final long
serialVersionUID
Private serial version unique ID to ensure serialization compatibility.
Constructors Summary
public ConnectionEvent(PooledConnection con)

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

param
con the pooled connection that is the source of the event
throws
IllegalArgumentException if con is null.

    super(con);         
  
public ConnectionEvent(PooledConnection con, SQLException ex)

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

param
con the pooled connection that is the source of the event
param
ex the SQLException about to be thrown to the application
throws
IllegalArgumentException if con is null.

    super(con);  
    this.ex = ex;
  
Methods Summary
public java.sql.SQLExceptiongetSQLException()

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

return
the SQLException about to be thrown or null

 return ex;