This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Kinda Confused::Update ResultSet

 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 168
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can't believe I am just now finding this out. That is going to save me a lot of work.
Thanks a bunch!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic