Resultset alternative

M

miche

If I work with a ResultSet, I must leave open my statement because if
I close the statement, automatically close also the relative
ResultSet. What can I use if I don't want leave the statement open but
I want work totally disconnect?

Thanks in advance!
Miche!
 
S

stefanomnn

with jdbc 3.0 you can use CachedRowSet class, which provide you a
disconnected ResultSet. here's a snippet:

Code:
Statement stmt = con.createStatement();
ResultSet rs =  stmt.executeQuery(
              "SELECT COF_NAME, PRICE FROM COFFEES");
 CachedRowSet rset = new CachedRowSet();
 crset.populate(rs);
 rs.close();
 stmt.close();

if you can't, you could create a collection of Map, where a map is a
row.

Stefano
 
M

miche

stefanomnn ha scritto:
with jdbc 3.0 you can use CachedRowSet class, which provide you a
disconnected ResultSet. here's a snippet:

Code:
Statement stmt = con.createStatement();
ResultSet rs =  stmt.executeQuery(
"SELECT COF_NAME, PRICE FROM COFFEES");
CachedRowSet rset = new CachedRowSet();
crset.populate(rs);
rs.close();
stmt.close();

if you can't, you could create a collection of Map, where a map is a
row.

Stefano

Hi Stefano

You are very kind...
I can try your suggestion...

Thank you so mutch!
Michele

bye bye
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top