java sql SQLException Can not issue data manipulation statem

1、错误描述

java.sql.SQLException:Can not issue data manipulation statements with executeQuery()

2、错误原因

Class.forName("com.mysql.jdbc.Driver");
Connection conn = null;
Statement stat = null;
ResultSet rs = null;
try
{
	conn = DriverManager.getConnection(url, username, password);
	stat = conn.createStatement();
	stat.executeQuery(sql);
}

Statement在调用查询SQL方法时,调用executeQuery,导致出错

3、解决办法

将“stat.executeQuery(sql);”换成“stat.execute(sql);”

再分享一下我老师大神的人工智能教程吧。零基础!通俗易懂!风趣幽默!还带黄段子!希望你也加入到我们人工智能的队伍中来!https://blog.csdn.net/jiangjunshow

原文地址:https://www.cnblogs.com/odejsjhshw/p/10368354.html

时间: 2024-11-09 01:39:08

java sql SQLException Can not issue data manipulation statem的相关文章

java.sql.SQLException:Can not issue data manipulation statements with executeQuery()

1.错误描述 2.错误原因 Class.forName("com.mysql.jdbc.Driver"); Connection conn = null; Statement stat = null; ResultSet rs = null; try { conn = DriverManager.getConnection(url, username, password); stat = conn.createStatement(); stat.executeQuery(sql); }

FSG报表打印报错,log文件显示java.sql.SQLException: No corresponding LOB data found

报错信息: +---------------------------------------------------------------------------+ Plsql 程序的日志信息开始 +---------------------------------------------------------------------------+ +-----------------------------------------------------------------------

java.sql.SQLException: Can not issue empty query.

1.错误叙述性说明 java.sql.SQLException: Can not issue empty query. 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:

Caused by java sql BatchUpdateException Can not issue exec

1.错误描述 org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [select student_id from b_student where student_code=? ]; Can not issue executeUpdate() for SELECTs; nested exception is java.sql.BatchUpdateException: Can

Caused by: java.sql.SQLException: ResultSet is from UPDATE. No Data.

1.错误描述 org.hibernate.exception.GenericJDBCException: error executing work at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:54) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(Sql

java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

org.springframework.dao.TransientDataAccessResourceException: ### Error updating database. Cause: java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed ### The error may involve defaultParameterMap ### T

java.sql.SQLException: Before start of result set

错误原因: 如API中所述 API: A table of data representing a database result set, which is usually generated by executing a statement that queries the database. A ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is p

MySql中报错:java.sql.SQLException: Incorrect string value: '\xF0\x9F\x90\xBB' for column

问题描述: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x90\xBB' for column 'nickName' at row 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1094) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4226) at com.mysql.jdbc.M

兔子-- Can not issue data manipulation statements with executeQuery()

  Can not issue data manipulation statements with executeQuery() 出错地方:st.executeQuery("insert  into  student  values("1","2","3")") ; 如果你的SQL 语句是 update,insert等更新语句,用statement的execute() 如果sql语句是查询语句则用statement.execu