java sql SQLException Can not issue data manipulation statem

Posted odejsjhshw

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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




以上是关于java sql SQLException Can not issue data manipulation statem的主要内容,如果未能解决你的问题,请参考以下文章

java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Date(示

Caused by: java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java

java.sql.SQLException: Can not issue data manipulation statements with execu 这是错误提示

gbase整合mybatis出现: Cause: java.sql.SQLException: Can't convert to: binary stream

java.sql.SQLException:将 Spark 数据帧保存到 Sybase 时找不到类型“TIMESTAMP”

idea 创建运行web项目时,报错: Can not issue executeUpdate() for SELECTs解决方案