Name
ConnectionEventListener
Synopsis
Interface Name:
javax.sql.ConnectionEventListener
Superclass: java.util.EventListener
Immediate Subclasses: None
Interfaces Implemented: None
Availability: New as of JDK 1.2
Description
This interface is implemented by classes wishing to know about events happening to pooled connections. A JDBC driver vendor implements this interface to be notified when a given connection has closed or thrown an exception.
Class Summary
public interface ConnectionEventListener extends java.util.EventListener { void connectionClosed(ConnectionEvent evt); void connectionErrorOccurred(ConnectionEvent evt); }
Object Methods
connectionClosed( )
public void connectionClosed(ConnectionEvent evt);
- Description
This method is called by a pooled connection when the
close( )
method has been called.
connectionErrorOccurred( )
public void connectionErrorOccurred(ConnectionEvent evt);
- Description
This method is called by a pooled connection whenever a fatal error occurs during communications with a database. For example, if the server goes down, the connection needs to notify the pool to discard this connection from the pool and attempt a reconnect.
Get Database Programming with JDBC & Java, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.