This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Updating a ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Updating a ResultSet" Watch "Updating a ResultSet" New topic

Updating a ResultSet

Rebecca Abraham
Ranch Hand

Joined: Feb 20, 2003
Posts: 37
I'm unable to update my resultset. My code is roughly as follows:
PreparedStatement pQuery = conDB.prepareStatement(LIST,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);

ResultSet rs = pQuery.executeQuery();
while (
String cDateTime = rs.getString ("time_timesheet_dte");
String cDate = cDateTime.substring(0,10);

rs.updateString("time_timesheet_dte", cDate);
I'm getting an SQLException: ResultSet not updateable
Is there some way I can update my resultset?
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

Hi Rebecca,
Unless your JDBC driver and/or database support updateable result sets, then you cannot use them. The documentation for your driver and database should mention these details. With my Oracle 8i database and the Oracle (thin) JDBC driver, there are restrictions on the type of database query I can execute if I want an updateable result set -- even though that combination is supposed to support updateable result sets.
Hope this helps.
Good Luck,
Rebecca Abraham
Ranch Hand

Joined: Feb 20, 2003
Posts: 37
Thank you for the information. My query has a join. I guess that's y i'm unable to update the resultset.
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
It certainly will be. Only a few databases support updating the results of joins, and even then only under very specific circumstances.
- Peter
I agree. Here's the link:
subject: Updating a ResultSet
It's not a secret anymore!