When I have needed to do this I have used a dynamic proxy, using
java.lang.reflect.Proxy, to extend Connection, Statement, and ResultSet.
This does not solve the problem at the driver level, but it does allow you a
lot of control to decide when and how often you re-try a query and when you
need to re-open the connection.
You can also make it very database independent.
It does however incur some extra overhead.
Craig