简体   繁体   English

在JSP中更新错误,日食

[英]updating error in JSP, eclipse


- Can not issue data manipulation statements with executeQuery(). -无法使用executeQuery()发出数据操作语句。


UPDATING JAVA CODE 更新JAVA代码

MultiDBManager db8=new MultiDBManager(uif);
String updateString = "UPDATE pklrsc SET pr_prod_rate="+rate+" , pr_ln_cst="+cost+" WHERE pr_rsc_cde= "+component+" ";
db8.execSQL(updateString);

.java FILE CODE .java文件代码

    public ResultSet execSQL(String sql) throws SQLException {
    System.out.println("execSQL");
    return super.execSQL(processQuery(sql));
    }

private String processQuery(String sql){
System.out.println("processQuery");
return mdb.getCacheDB().procSQL(sql, false);
}

ERROR MESSAGE 错误信息

value i: 1
component: ACODE0001
rate: 2.00
cost: 261.22
execSQL
processQuery
Execute = UPDATE c66_p30_BIS.pklrsc SET pr_prod_rate=2.00 , pr_ln_cst=261.22 WHERE pr_rsc_cde= ACODE0001 
Nov 4, 2010 4:54:49 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
 at com.mysql.jdbc.Statement.checkForDml(Statement.java:398)

You must call executeUpdate() when using INSERT / UPDATE / DELETE , rather than executeQuery() 使用INSERT / UPDATE / DELETE ,必须调用executeUpdate() ,而不是executeQuery()

Also note that using code in JSP, which is a view technology, is not encouraged. 还要注意,不鼓励在JSP中使用一种视图技术的代码。

You're using a hidden executeQuery call to update values in the database. 您正在使用隐藏的executeQuery调用来更新数据库中的值。 That's not allowed (see exception). 不允许这样做(请参阅例外)。

This method call actually causes your trouble: 该方法调用实际上会导致您的麻烦:

mdb.getCacheDB().procSQL(sql, false);

Find an alternative to send update statements (Actually I don't know what API you're using here) 查找发送更新语句的替代方法(实际上,我不知道您在这里使用的是什么API)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM