mercredi 24 février 2016

Get the results after the it is closed

I am using the sqlite driver with java. As you know the typical order is

Create Statement
Execute Statement
Get ResultSet

Process Results

close ResultSet
close statement

The problem is that all of above is in one method and I want the caller to get the results and process it. However since the results are returned at the end of the method then by then the statement and the result set is closed.

The only work around I can think of is to have the RS and the Stmnt be a class variable and have the caller close them but this will pose problem if it is multi threaded env.

What is the recommended way to achieve what I want? Thanks

Aucun commentaire:

Enregistrer un commentaire