File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Updating a ResultSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Updating a ResultSet" Watch "Updating a ResultSet" New topic
Author

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);

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

Joined: Oct 11, 2000
Posts: 1132

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

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.
Rebecca
Peter den Haan
author
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: http://aspose.com/file-tools
 
subject: Updating a ResultSet