-
- All Superinterfaces:
- EventListener
public interface StatementEventListener extends EventListener
An object that registers to be notified of events that occur on PreparedStatements that are in the Statement pool.The JDBC 3.0 specification added the maxStatements
ConnectionPooledDataSource
property to provide a standard mechanism for enabling the pooling ofPreparedStatements
and to specify the size of the statement pool. However, there was no way for a driver to notify an external statement pool when aPreparedStatement
becomes invalid. For some databases, a statement becomes invalid if a DDL operation is performed that affects the table. For example an application may create a temporary table to do some work on the table and then destroy it. It may later recreate the same table when it is needed again. Some databases will invalidate any prepared statements that reference the temporary table when the table is dropped.Similar to the methods defined in the
ConnectionEventListener
interface, the driver will call theStatementEventListener.statementErrorOccurred
method prior to throwing any exceptions when it detects a statement is invalid. The driver will also call theStatementEventListener.statementClosed
method when aPreparedStatement
is closed.Methods which allow a component to register a StatementEventListener with a
PooledConnection
have been added to thePooledConnection
interface.- Since:
- 1.6
-
-
Method Summary
Methods Modifier and Type Method and Description void
statementClosed(StatementEvent event)
The driver calls this method on allStatementEventListener
s registered on the connection when it detects that aPreparedStatement
is closed.void
statementErrorOccurred(StatementEvent event)
The driver calls this method on allStatementEventListener
s registered on the connection when it detects that aPreparedStatement
is invalid.
-
-
-
Method Detail
-
statementClosed
void statementClosed(StatementEvent event)
The driver calls this method on allStatementEventListener
s registered on the connection when it detects that aPreparedStatement
is closed.- Parameters:
event
- an event object describing the source of the event and that thePreparedStatement
was closed.- Since:
- 1.6
-
statementErrorOccurred
void statementErrorOccurred(StatementEvent event)
The driver calls this method on allStatementEventListener
s registered on the connection when it detects that aPreparedStatement
is invalid. The driver calls this method just before it throws theSQLException
, contained in the given event, to the application.- Parameters:
event
- an event object describing the source of the event, the statement that is invalid and the exception the driver is about to throw. The source of the event is thePooledConnection
which the invalidPreparedStatement
is associated with.- Since:
- 1.6
-
-
Traduction non disponible
Les API Java ne sont pas encore traduites en français sur l'infobrol. Seule la version anglaise est disponible pour l'instant.
Version en cache
19/12/2024 03:46:36 Cette version de la page est en cache (à la date du 19/12/2024 03:46:36) afin d'accélérer le traitement. Vous pouvez activer le mode utilisateur dans le menu en haut pour afficher la dernère version de la page.Document créé le 11/06/2005, dernière modification le 04/03/2020
Source du document imprimé : https://www.gaudry.be/java-api-rf-javax/sql/statementeventlistener.html
L'infobrol est un site personnel dont le contenu n'engage que moi. Le texte est mis à disposition sous licence CreativeCommons(BY-NC-SA). Plus d'info sur les conditions d'utilisation et sur l'auteur.
Références
Ces références et liens indiquent des documents consultés lors de la rédaction de cette page, ou qui peuvent apporter un complément d'information, mais les auteurs de ces sources ne peuvent être tenus responsables du contenu de cette page.
L'auteur de ce site est seul responsable de la manière dont sont présentés ici les différents concepts, et des libertés qui sont prises avec les ouvrages de référence. N'oubliez pas que vous devez croiser les informations de sources multiples afin de diminuer les risques d'erreurs.