O'Reilly logo

Database Programming with JDBC & Java, Second Edition by George Reese

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required