我对一个可写的结果集进行写操作,可是总是不成功。程序原来是运行在ORACLE下面的,运行正常,现在移植到MYSQL下面就不行了。
首先报的错误是
Result Set not updatable.This result set must come from a statement that was created with a result set type of ResultSet.CONCUR_UPDATABLE, the query must select only one table, and must select all primary keys from that table. See the JDBC 2.1 API Specification, section 5.6 for more details.
上网找了一下,说是表要建主键,我就建一个。
结果果然不报这个错了,但是报
java.lang.NullPointerException。我操作的语句是
statement = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);rstablename = statement.executeQuery(sql);
while(rstablename.next()){
      rstablename.updateString("JZWCBZ","1");两个问题:1.有些时候我建了主键,还是报第一个错误。
         2.建立了主键第一错误消失的情况下,空指针应该怎么解决。谢谢