JavaTM 2 Platform
Standard Ed. 6

javax.sql
接口 ConnectionEventListener

所有超级接口:
EventListener

public interface ConnectionEventListener
extends EventListener

注册该对象便可获得由 PooledConnection 对象生成的事件的通知。

ConnectionEventListener 接口由连接池组件实现。连接池组件通常由 JDBC 驱动程序供应商或另一个系统软件供应商提供。当使用注册了侦听器的入池连接完成应用程序时,JDBC 驱动程序将向 ConnectionEventListener 对象发出通知。该通知发生在应用程序对其 PooledConnection 对象表示形式调用 close 方法之后。当连接因 PooledConnection 不适合将来使用而发生连接错误时(例如,服务器崩溃),ConnectionEventListener 也将得到通知。JDBC 驱动程序仅在驱动程序使用 PooledConnection 对象向应用程序抛出 SQLException 之前向侦听器发出通知。

从以下版本开始:
1.4

方法摘要
 void connectionClosed(ConnectionEvent event)
          通知此 ConnectionEventListener 应用程序已对其入池连接的表示形式调用 close 方法。
 void connectionErrorOccurred(ConnectionEvent event)
          通知此 ConnectionEventListener 发生了严重错误,入池连接不再可用。
 

方法详细信息

connectionClosed

void connectionClosed(ConnectionEvent event)
通知此 ConnectionEventListener 应用程序已对其入池连接的表示形式调用 close 方法。

参数:
event - 描述事件源的事件对象

connectionErrorOccurred

void connectionErrorOccurred(ConnectionEvent event)
通知此 ConnectionEventListener 发生了严重错误,入池连接不再可用。驱动程序仅在向应用程序抛出包含在给定 ConnectionEvent 对象中的 SQLException 时发出此通知。

参数:
event - 一个事件对象,它描述事件源和包含驱动程序将抛出的 SQLException

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见

版权所有 2008 Sun Microsystems, Inc. 保留所有权利。请遵守GNU General Public License, version 2 only