Resultset processes 1 record

Being a newbie to Java coding, I'm stump on what is causing this problem. I execute a query and able to process 1 record from the result set. When it attempts to get 2nd record, it state that the result set is closed.

That depends on what you do while processing the rows. All we can see of that code right now is this: And that doesn't tell us anything. Most likely inside that loop you do something that causes the result set to be closed.

Michael McAuliffe

Greenhorn

Posts: 14

posted 10 years ago

Sorry! I thought the problem was in the DBHandler class. Here is the code

A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results.

Just Take a look at your DBHandler Class

The statement here is a Class level variable, which means it will be shared among requests, and every new execution will close the previos resultset.

Hope now you have found the problem.

Thanks Shailesh

Gravitation cannot be held responsible for people falling in love ~ Albert Einstein

Michael McAuliffe

Greenhorn

Posts: 14

posted 10 years ago

Thank you for the help. As a newbie, that is learning OTJ it is a huge learning curve.