开发者

updating error in JSP, eclipse


- Can not issue data manipulation statements with executeQuery().


UPDATING JAVA CODE

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

    public ResultSet execSQL(String sql) throws SQLException开发者_StackOverflow中文版 {
    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()

Also note that using code in JSP, which is a view technology, is not encouraged.


You're using a hidden executeQuery call to update values in the database. 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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜