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);
}
Statement在调用查询SQL方法时,调用executeQuery,导致出错
3、解决办法
将“stat.executeQuery(sql);”换成“stat.execute(sql);”
时间: 2024-07-30 13:52:23