Consider the following situation :
try (ResultSet resultSet = DriverManager.getConnection("jdbc:...", "user", "pass")