Use JDBC's own 'isValid' method