Improve connection re-establishment to account for NPEs in the JDBC
driver