Re: ResultSet.updateString against DB2 giving "Column not updatable"
- From: Joe Weinstein <joeNOSPAM@xxxxxxx>
- Date: Wed, 28 Jun 2006 11:23:07 -0700
adamcrume@xxxxxxxxx wrote:
I'm trying to use what I think may called an "inline update" against a
table in DB2. My code basically looks like this:
PreparedStatement p=
con.prepareStatement("select my_col from my_table where my_key=?",
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_UPDATABLE);
p.setString(1, key);
ResultSet rs=p.executeQuery();
if(!rs.next()) {
throw new SQLException("Not found: "+key);
}
String oldValue=rs.getString(1);
rs.updateString(1, newValue); // <-- problem here
rs.updateRow();
The problem is that the updateString method call throws a SQLException
that says "Column not updatable." I have rights to perform the update,
because if I do a select statement then an update statement, it works.
Any ideas what's going on or how to fix it? I've tried saying "select
... for update of my_col," but that doesn't work either.
Hi. There's nothing wrong with your JDBC. It seems the
driver is silently downgrading your ResultSet to a
non updateable one. Check the driver documents about this.
Joe Weinstein at BEA Systems
.
- Follow-Ups:
- References:
- ResultSet.updateString against DB2 giving "Column not updatable"
- From: adamcrume
- ResultSet.updateString against DB2 giving "Column not updatable"
- Prev by Date: ResultSet.updateString against DB2 giving "Column not updatable"
- Next by Date: Re: ResultSet.updateString against DB2 giving "Column not updatable"
- Previous by thread: ResultSet.updateString against DB2 giving "Column not updatable"
- Next by thread: Re: ResultSet.updateString against DB2 giving "Column not updatable"
- Index(es):
Relevant Pages
|