How can I fix below sonarqube issue

Please check the below screenshot. I was able to fix all the other issues using try-with-resources. But I'm confusing how to fix this using try-with-resources.

enter image description here


I think it supposed to be done like following

try (Connection con = client.getConnection();
     Statement stmt = con.createStatement()) {
    ResultSet result = stmt.executeQuery(...)
    ...
}