aspose file tools
The moose likes JDBC and the fly likes Kinda Confused::Update ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Kinda Confused::Update ResultSet" Watch "Kinda Confused::Update ResultSet" New topic
Author

Kinda Confused::Update ResultSet

Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

If I make a ResultSet Updatable, and then make changes to the ResultSet, does that actually change the database as well or do I still have to update the database?
I didn't know if a ResultSet was just a cached dataset from the database or if it was still connected.
Thanks.
Michael Zalewski
Ranch Hand

Joined: Apr 23, 2002
Posts: 168
A ResultSet is still connected to the database.
To update an updatable ResultSet, you would have to call ResultSet.updateRow() after you made the changes.
When you call methods like ResultSet.updateString( int, String), nothing happens to the database (except maybe locking the row, depending on the ResultSet cursor parameters and the database driver).
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

I can't believe I am just now finding this out. That is going to save me a lot of work.
Thanks a bunch!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Kinda Confused::Update ResultSet
 
Similar Threads
.NET dataset in java
SQLException: unable to execute updateString for read only Resultset
what is difference between JDBC1 and JDBC2 ?
SQLException: No ResultSet
Updateable ResultSet