Re: ResultSet.updateString against DB2 giving "Column not updatable"





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

.



Relevant Pages

  • Re: oracle Metadata abfragen (getColumns)
    ... public String[] getTabMetaData{ ... irriteirt.....bedeutet dies EIN ResultSet Objekt, ... ResultSet resultSetExportedKeys = pMeta.getExportedKeys(DATABASE_CATALOG_NAME, null, pTableName); ... ImportedKey importedKey = importedKeyMap.get); ...
    (de.comp.lang.java)
  • Re: java.sql.SQLException: ResultSet is from UPDATE. No Data.
    ... ResultSet rs2 = findFoodCode.executeQuery; ... findFoodCode is a PreparedStatement containing an UPDATE ... public static void main (String args ) throws Exception { ...
    (comp.lang.java.databases)
  • Re: Select auf Oracle-DB
    ... ich habe aber keine Ahnung, ob das so in Ordnung ist. ... z.B. wie man das Resultset wieder als String ausgibt... ...
    (de.comp.lang.java)
  • Re: resultset to date conversion
    ... i am trying to convert resultset into a string.. ... It is working properly in sql and giving proper results. ... resultset format. ... But i want this result in either string or integer format. ...
    (comp.lang.java.help)
  • Re: getting Multiple resultsets in java using stored procedure in MS SQL Server 2000
    ... I am using a comma seperated value string as the parameter viz ... the query used in the procedure is a select statement with an IN clause ... empty resultset. ...
    (microsoft.public.sqlserver.jdbcdriver)