Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

Resultset alternative

Thread view: 
miche - 21 Jun 2007 08:27 GMT
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!
stefanomnn - 21 Jun 2007 09:32 GMT
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();
[/code]

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

Stefano
miche - 21 Jun 2007 09:55 GMT
stefanomnn ha scritto:

> with jdbc 3.0 you can use  CachedRowSet class, which provide you a
> disconnected ResultSet. here's a snippet:
[quoted text clipped - 13 lines]
>
> Stefano

Hi Stefano

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

Thank you so mutch!
Michele

bye bye


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.