java.sql.BatchUpdateException: Can not issue SELECT via executeUpdate(...
java.sql.BatchUpdateException: Can not issue SELECT via executeUpdate() or executeLargeUpdate().
java.sql.BatchUpdateException: Can not issue SELECT via executeUpdate() or executeLargeUpdate().
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:422) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createBatchUpdateException(SQLError.java:1162) at com.mysql.jdbc.StatementImpl.executeBatchInternal(StatementImpl.java:1060) at com.mysql.jdbc.StatementImpl.executeBatch(StatementImpl.java:970) at com.alibaba.xxptqa.util.DbUtil.query(DbUtil.java:20) at com.alibaba.xxptqa.api.MuradinDbExecutor.execute(MuradinDbExecutor.java:24) at com.alibaba.xxptqa.api.MuradinDbExecutorTest.testQuery(MuradinDbExecutorTest.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68) at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Caused by: java.sql.SQLException: Can not issue SELECT via executeUpdate() or executeLargeUpdate().
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:897)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:886)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:860)
at com.mysql.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1515)
at com.mysql.jdbc.StatementImpl.executeBatchInternal(StatementImpl.java:1034)
... 26 more
在JdbcTemplate批量添加或修改的SQL语句,应该是insert into 或update语句,但是这里写成了select查询语句
解决方案:
(1)如果是批量新增或修改操作,SQL语句要是insert into 或 update 语句
(2)如果是批量查询操作,SQL是select语句,但是不能调用batchUpdate方法
低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。
持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。
- 上一篇
SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required
获取数据库连接失败! java.sql.SQLNonTransientConnectionException: CLIENT_PLUGIN_AUTH is required at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:526) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:513) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:505) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:479) at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:489) at com.mysql.cj.jd...
- 下一篇
5月24日云栖精选夜读丨阿里巴巴海外新动作!投资了一家黑科技时尚公司
近日,阿里巴巴集团对一家名为Ordre的奢侈品服饰网站进行了战略投资,但具体投资金额未对外披露。 据外媒Drapers报道,阿里巴巴表示,这一投资意味着其在全球时尚版图的扩张上又迈出了一步,从而更好地“连接中国高净值消费者和全球奢侈品资源”。 热点热议 阿里巴巴海外新动作!投资了一家黑科技时尚公司 作者:技术小能手 点餐速度碾压收银员,揭秘阿里云AI点餐机背后的黑科技 作者:仁太 前世今生:蚂蚁金服自研数据库OceanBase的道路与思考 作者:技术小能手 知识整理 Python Fire试用体验 作者:ahlfors HDFS应用场景、原理、基本架构 作者:调皮仔3683 Hystrix熔断机制原理剖析 作者:技术小能手 在 Linux 中轻松搜索和安装 Google Web 字体 作者:技术小能手 使用Python Log Handler自动上传并解析KV格式的日志 作者:成喆 美文回顾 秒变莫扎特、贝多芬,Facebook提出完美转换音乐风格的神经网络 作者:技术小能手 阿里新零售军团今天全面集结,启动了一个大计划 作者:技术小能手 如何在工作中学习 作者:plantegg 新兴...
相关文章
文章评论
共有0条评论来说两句吧...
文章二维码
点击排行
-
Docker使用Oracle官方镜像安装(12C,18C,19C)
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- CentOS8编译安装MySQL8.0.19
- Docker快速安装Oracle11G,搭建oracle11g学习环境
- SpringBoot2配置默认Tomcat设置,开启更多高级功能
- MySQL8.0.19开启GTID主从同步CentOS8
- CentOS7,8上快速安装Gitea,搭建Git服务器
- Jdk安装(Linux,MacOS,Windows),包含三大操作系统的最全安装
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果
推荐阅读
最新文章
- Springboot2将连接池hikari替换为druid,体验最强大的数据库连接池
- Docker使用Oracle官方镜像安装(12C,18C,19C)
- CentOS6,CentOS7官方镜像安装Oracle11G
- SpringBoot2整合Redis,开启缓存,提高访问速度
- Jdk安装(Linux,MacOS,Windows),包含三大操作系统的最全安装
- SpringBoot2配置默认Tomcat设置,开启更多高级功能
- SpringBoot2整合MyBatis,连接MySql数据库做增删改查操作
- Hadoop3单机部署,实现最简伪集群
- MySQL8.0.19开启GTID主从同步CentOS8
- SpringBoot2编写第一个Controller,响应你的http请求并返回结果