Closed
Description
This interface may be implemented by a driver that wants to be notified by DriverManager when the driver is deregistered.
A DriverAction
implementation is not intended to be used directly by applications. A JDBC Driver
may choose to create its DriverAction
implementation in a private class to avoid it being called directly.
The JDBC driver's static initialization block must call DriverManager.registerDriver(java.sql.Driver, java.sql.DriverAction)
in order to inform DriverManager
which DriverAction
implementation to call when the JDBC driver is de-registered.
Example:
public class SQLDriver implements java.sql.Driver {
static SQLDriverAction driverAction = new SQLDriverAction();
static {
try {
java.sql.DriverManager.registerDriver(new SQLDriver(), driverAction);
} catch (SQLException e) {
throw new RuntimeException("Can't register driver!");
}
}
private class SQLDriverAction implements java.sql.DriverAction {
...
}
}
See more here.