Link to home
Start Free TrialLog in
Avatar of tiagoml
tiagoml

asked on

Can´t i use a ResultSet after i close the connection?

I starting to work with JAVA but i have worked with MSSQL Server 2000 using VB6 for a while, with VB i had to "manualy" clone the RecordSet if i wanted to work with it after i closed the connection to the DB, does JAVA have the same problem? when i close the connection the resultSet also closes?

If so do i have to run the resultset copying it row by row into a disconected one so i can keep it after i close the connection?(thats wath i did in VB :( )

thanks

Avatar of radarsh
radarsh

Nope! You can't do that!

________
radarsh
Why would you want to work with a resultset after the connection is closed?

________
radarsh
SOLUTION
Avatar of mrigank
mrigank

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
There is a method populate(ResultSet rs) in CachedRowSet.
Use it for and then use the CachedRowSet object.
Avatar of tiagoml

ASKER


There is a method populate(ResultSet rs) in CachedRowSet.
Use it for and then use the CachedRowSet object.


I cant seem to find that method :(.
very newbie, sorry.


As for what i want it for, its because im gonna work with the data to give a result but im not doing anything to the DB after that, so theres no reason to let the connection be open if im not doing anything with it anymore :)
The method is not present in the interface but is there in the concrete implementation classes ;).

Which CachedRowSet impl are you using ?
SOLUTION
Avatar of Mayank S
Mayank S
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I think mrigank deserved some points here.
Avatar of tiagoml

ASKER

thanks for the code rama_krishna580'

thanks mayankeagle also
i acepted rama_krishna580's answer because of the sample code. As is said im a real noob at java :D. Hope i did the right thing.
Well, you have an option of splitting the points between experts. You should not always accept a comment which blankly gives you all the code because in some cases, it is against EE rules (like in homework questions, though this one might not be homework).
Avatar of tiagoml

ASKER


this is not homework :D

i didnt see that ... can i do the spliting now?
I've asked Venabili, our Page Editor to re-open this question. Then you can split the points by following the Split Points link which will be shown above the Comment box.
Avatar of tiagoml

ASKER

ok ill wait for it then :D

thanks