Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Updating a ResultSet

 
Rebecca Abraham
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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);

pQuery.setString(1,domainNbr);
ResultSet rs = pQuery.executeQuery();
while (rs.next())
{
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?
Thanks,
Rebecca
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
Avi.
 
Rebecca Abraham
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the information. My query has a join. I guess that's y i'm unable to update the resultset.
Rebecca
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It certainly will be. Only a few databases support updating the results of joins, and even then only under very specific circumstances.
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic