如何不能修改?
什么状况?
什么jdbc driver?
修改部分的代码?

解决方案 »

  1.   

    看看你用来操作数据库的用户名是不是有权限修改数据库。
    java数据库驱动不支持数据库更新--------那还要他来干吗?
      

  2.   

    可以改的,不过在创建stmt的时候要加参数
      

  3.   

    一字之差  是不支持数据"集"更新
    楼上的说要改参数,怎么改啊?Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection conn = DriverManager.getConnection(
               "jdbc:oracle:thin:@flamingo:1521:j2eebook",
                        "j2eeuser", "j2eepass");
               Statement stmt = conn.createStatement(
                    ResultSet.TYPE_SCROLL_SENSITIVE,
                    ResultSet.CONCUR_UPDATABLE);
                stmt.executeQuery("select * from Person");
                ResultSet results = stmt.getResultSet();
             while (results.next())
             {
            String firstName = results.getString("first_name");
            String lastName = results.getString("last_name");
            results.updateString("first_name", firstName.toUpperCase());
            results.updateString("last_name", lastName.toUpperCase());
            results.updateRow();
                }
                conn.close();
            }
            catch (Exception exc)
            {
                exc.printStackTrace();
            }
    执行到
    results.updateString("first_name", firstName.toUpperCase());
    就出错.
      

  4.   

    应该还是驱动的问题 看看是不是支持jdbc2。0的
      

  5.   

    我用的是CLASS12,难道不对吗
      

  6.   

    Statement stmt = conn.createStatement(
                    ResultSet.TYPE_SCROLL_SENSITIVE,
                    ResultSet.CONCUR_UPDATABLE);
    是jdbc 2.0 才支持的, 如果要update ,
    也可以自己写sql , stmt.executeUpdate("update XXtable set XX='xx' where YY = 'yy'")