public interface StatementEventListener extends EventListener
JDBC 3规范增加了maxstatements ConnectionPooledDataSource物业提供使PreparedStatements汇集标准机制和指定的语句池的大小。然而,没有一个司机通知外部声明池当PreparedStatement无效。对于一些数据库,声明无效,如果执行DDL操作影响表。例如,一个应用程序可以创建一个临时表来做一些工作在表上,然后摧毁它。它可能后来重新创建相同的表时,它是必要的。一些数据库将使任何的准备好的语句引用临时表删除表时。
类似于在ConnectionEventListener接口中定义的方法,驱动程序将调用StatementEventListener.statementErrorOccurred方法抛出任何异常当它检测到一个无效之前的声明。司机也会打电话给StatementEventListener.statementClosed方法当PreparedStatement关闭。
方法允许一个组件与一个PooledConnection登记一statementeventlistener已被添加到PooledConnection接口。
| Modifier and Type | Method and Description |
|---|---|
void |
statementClosed(StatementEvent event)
驱动程序调用此方法在所有
StatementEventListeners注册连接时,它检测到一个
PreparedStatement关闭。
|
void |
statementErrorOccurred(StatementEvent event)
驱动程序调用此方法在所有
StatementEventListeners注册连接时,它检测到一个
PreparedStatement无效。
|
void statementClosed(StatementEvent event)
StatementEventListeners注册连接时,它检测到一个
PreparedStatement关闭。
event -一个事件对象描述的事件源,
PreparedStatement关闭。
void statementErrorOccurred(StatementEvent event)
StatementEventListeners注册连接时,它检测到一个
PreparedStatement无效。驱动程序调用此方法之前,这把
SQLException,包含在给定的事件,给应用程序。
event -一个事件对象描述的事件源,声明是无效的,司机就要抛出异常。事件的来源是无效的
PreparedStatement与
PooledConnection。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.