标签:
当出现下面错误时:
java.sql.SQLException: Can not issue data manipulation statements with executeQuery().
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
at com.mysql.jdbc.StatementImpl.checkForDml(StatementImpl.java:436)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2176)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at com.cp.dsd.UserDAO.insert(UserDAO.java:33)
at com.cp.dsd.SpringDAODemo.main(SpringDAODemo.java:16)
原因是:进行数据的insert、update等操作时,不能用statement的executeQuery()方法,要改为execute()方法。
标签:
原文地址:http://www.cnblogs.com/checkingpei/p/5055438.html