M
M
Maks Burkov2017-03-27 20:11:00
Java
Maks Burkov, 2017-03-27 20:11:00

How to use Result Set correctly?

I don’t understand how to go through the result if it closes immediately after the request is returned from the database?
I read the doc and did not understand how to go through it ..

mappedObjects.put("company",comp);
        ResultSet res = findInDatabase(mappedObjects);
        System.out.println(res.isClosed()); // true 
        while(res.next()){ // Это создаёт Exception ? 
            // code 
        }

Exception:
java.sql.SQLException: Operation not allowed after ResultSet closed

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-03-30
@dsv

Understand what's going on inside findInDatabase. Probably there is a closure.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question