DriverManager.deregisterDriver -> Driver.deregister

Lance Andersen - Oracle Lance.Andersen at
Wed Jan 16 12:37:01 PST 2013

Douglas has proposed the following which is under discussion/consideration if we have any runway after M6

JDBC 4.2 should add a hook to Driver so that a Driver instance can be notified when it is deregistered. One approach would be:

 in java.sql.Driver
 /** Do any local cleanup required when the entire driver is deregistered.
 public void deregister(); // no exceptions

Then in the JavaDoc for DriverManager.deregisterDriver add:

 This method calls deregister() on the Driver being deregistered
 if the method exists. If the Driver implements an older version
 of the JDBC spec and does not implement the deregister() method
 then no exception is thrown.

As it stands there is no way for a driver to know it has been deregistered. If it creates any resources on being loaded, there is no way for it to clean up those resources.



Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at

More information about the jdbc-spec-discuss mailing list