欢迎投稿

今日深度:

java.sql.SQLException:Can not issue data manipulation statem

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


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);”


www.htsjk.Com true http://www.htsjk.com/shujukunews/6462.html NewsArticle java.sql.SQLException:Can not issue data manipulation statements with executeQuery(),executequery 1、错误描述 java.sql.SQLException:Can not issue data manipulation statements with executeQuery() 2、错误原因 Class.forName(com.mys...
评论暂时关闭