这句话错了,
(ResultSet.TYPE_FORWARD_ONLY ,ResultSet.CONCUR_UPDATABLE);需要改为:
(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);

解决方案 »

  1.   

    为什么一定要这样做,直接用update语句不就可以了么
      

  2.   

    我是用来上载文件用的,先保存文本数据,再保存blob数据呀,请教了,各位。
      

  3.   

    为何没人回答我的问题呀?
    我用mysql测试可以通过,但在oracle下却出现此问题,是数据库的问题??
      

  4.   

    我用oracle试过了,是有这样的错误,应该是数据库驱动的问题,可以换换其他的驱动试试看,因为我现在用的驱动是瘦客户机的驱动连接
      

  5.   

    Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY ,ResultSet.CONCUR_UPDATABLE);if(rs.next()){
    rs.updateString("file_name","davidtest");
    }
    rs.updateRow();这样行吗?---------------
    [email protected]
      

  6.   

    这个问题在java api文档中有过解释,现提供如下:
         With the addition of new functionality in the JDBC 2.0 API, it is possible for an application to request features that a DBMS or driver do not support. If the driver does not support scrollable result sets, for example, it may return a forward-only result set. Also, some queries will return a result set that cannot be updated, so requesting an updatable result set would have no effect for those queries. A general rule is that a query should include the primary key as one of the columns it selects, and it should reference only one table. New methods in the JDBC 2.0 API let an application discover which result set features a driver supports. If there is any doubt about whether a feature is supported, it is advisable to call these methods before requesting the feature. The following DatabaseMetaData methods indicate whether a driver supports a given result set type or a given result set concurrency: DatabaseMetaData.supportsResultSetType - returns a boolean indicating whether the driver supports the given result set type 
    DatabaseMetaData.supportsResultSetConcurrency - returns a boolean indicating whether the driver supports the given concurrency type in combination with the given result set type 
    The following ResultSet methods return the result set type and result set concurrency for the particular result set on which the method is called: ResultSet.getType - returns the type of this result set 
    ResultSet.getConcurrency - returns the concurrency mode of this result set 
    If an application specifies a scrollable result set and the driver does not support scrolling, the driver will issue a warning on the Connection object that produced the statement and return a result set that is forward-only. Even if the driver supports scrollable result sets, it is possible for an application to request a scrollable type that the driver does not support. In such a case, the driver will issue an SQLWarning on the Connection object that produced the statement and return a scrollable result set of a type that it does support, even if it differs from the exact type requested. For example, if an application requests a TYPE_SCROLL_SENSITIVE result set and the driver does not support that type, it could return a TYPE_SCROLL_INSENSITIVE result set if it supports that type. The driver would also alert the application that it did not return the exact type requested by issuing an SQLWarning on the Connection object that produced the statement requesting the unsupported result set type. Similarly, if an application specifies an updatable result set, a driver that does not support updatable result sets will issue an SQLWarning on the Connection object that produced the statement and return a read-only result set. If the application requests both an unsupported result set type and an unsupported concurrency type, the driver should choose the result set type first. In some situations, a driver may need to choose an alternate result set type or concurrency type at statement execution time. For example, a SELECT statement that contains a join over multiple tables might produce a result set that is not updatable. In such a situation, the driver will issue an SQLWarning on the Statement, PreparedStatement, or CallableStatement object that tried to create the result set instead of issuing it on the Connection object. The driver will then choose an appropriate result set type and/or concurrency type according to the guidelines in the preceding two paragraphs. 
         问题就是由于数据库驱动的问题,你可以通过rs.getConcurrency()查看当前记录集的游标类型,如果是ResultSet.CONCUR_UPDATABLE,表示可以做更新,但如果是ResultSet.CONCUR_READ_ONLY,就表示不能做更改数据库操作。
         明白了么?
      

  7.   

    解决的方法是:不要用select * ...作查询,
    而要用select <直接写出所有字段>的方式.