错误信息:
java.sql.SQLException: Can not issue data manipulation statements with executeQuery(). at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:935) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:924) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:870) at com.mysql.jdbc.StatementImpl.checkForDml(StatementImpl.java:472) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1401) at com.you.sql.Student.commonMethod(Student.java:117) at com.you.sql.Student.insertStudent(Student.java:86) at com.you.sql.Student.main(Student.java:181)
2、错误原因
执行添加语句代码时,调用查询executeQuery()方法出现错误;
解决办法:
由于在执行插入操作时,不能调用了executeQuery方法,
插入操作应该调用executeUpdate方法
Can not issue data manipulation statements with executeQuery()
最新推荐文章于 2021-01-27 15:57:42 发布