springboot使用jpa,删除功能sql报错解决

springboot使用jpa时报错:

只有删除时报错了,

"data": "删除失败,原因:Could not open JPA EntityManager for transaction; nested exception is javax.persistence.PersistenceException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure\n\nThe last packet successfully received from the server was 190,731 milliseconds ago. The last packet sent successfully to the server was 4 milliseconds ago.",
"success": false

解决方案:增加了配置:&failOverReadOnly=false

对应中文环境,通常mysql连接URL可以设置为:
jdbc:mysql://localhost:3306/test?user=root&password=&useUnicode=true&characterEncoding=gbk&autoReconnect=true&failOverReadOnly=false

在使用数据库连接池的情况下,最好设置如下两个参数:
autoReconnect=true&failOverReadOnly=false

时间: 2024-08-06 10:45:38

springboot使用jpa,删除功能sql报错解决的相关文章

由于删除DBF文件报错 —— ORA-01033: ORACLE initialization or shutdown in progress

由于移动或删除DBF文件报错:ORA-01033: ORACLE initialization or shutdown in progress 原因:一般该类故障通常是由于移动文件而影响了数据库日志文件出现损坏而导致的无法正常进行IO操作而引起的错误.ORACLE将识别为数据库未装载完成而导致出现如上错误. 故障特征:使用命令行sqlplus或PL/SQL Developer均无法打开数据库.但是可以使用sys用户以sysdba的身份登录系统 解决方法: 1. 在 ‘开始’-->‘运行’执行cm

mysql - sql报错You can't specify target table 'table_name' for update in FROM clause

今天写了个更新数据库表的语句,本意是根据某个条件,筛选出该表某些数据之后,对这些数据进行删除操作,如下 delete from t_person where id in (select id from t_person where name = "hello"); 然而却报错: You can't specify target table 't_person' for update in FROM clause 以下这篇博客( https://blog.csdn.net/qq_2967

Spring集成JPA配置懒加载两个报错解决办法

一:报错no session 因为entitymanager对象在事物提交后就关闭了 报错的 no session相当于sql的session 解决办法:解决办法 在web.xmL配置一个过滤器 使其在这个session中的manager在结束后再关闭open <!--配置openmanager--> <filter> <filter-name>openEntity</filter-name> <filter-class>org.springfr

利用sql报错帮助进行sql注入

我们可以利用sql报错帮助进行sql注入,这里以sql server 为例: sql查询时,若用group by子句时,该子句中的字段必须跟select 条件中的字段(非聚合函数)完全匹配,如果是select * ,那就必须将该表中所有列名都包含在group by 中:若少了哪个,就会报错,报错中会提示如下; 选择列表中的列 '列名'无效,因为该列没有包含在聚合函数或 GROUP BY 子句中. 这个提示的列名是按该表中的顺序来的,这时我们可以利用这点进行sql注入中枚举所有列的工作: 先使用

mysql 更新sql报错:You can&#39;t specify target table &#39;wms_cabinet_form&#39; for update in FROM clause

数据库里面有两个字段的位置不对,要把他们对调换下.因为没有数据库写的权限,需要用sql语句来实现.原来以为简单的 update table a set a.字段a=(select b字段 from table  where id=?) ,set a.字段b=(select a字段 from table where id=?) where id=? ,结果报了 这个问题 You can't specify target table 'wms_cabinet_form' for update in

转 sqlplus执行sql报错:ORA-01756:

1.sqlplus执行sql报错:ORA-01756: quoted string not properly terminated   分类: 技术 在SQLPLUS中执行SQL文件时发生错误:ORA-01756: quoted string not properly terminated 但是SQL其实是没有问题的,找了很多原因,发现可能是由于使用TOAD导出SQL insert语句,编码集的问题导致的. 首先在.bash_profile文件中添加环境变量指定编码集: export NLS_L

iOS关于使用for in循环删除数组元素报错

原文链接: iOS关于使用for in循环删除数组元素报错 简书主页:http://www.jianshu.com/users/37f2920f6848 Github主页:https://github.com/MajorLMJ iOS开发者公会-技术1群 QQ群号:87440292 iOS开发者公会-技术2群 QQ群号:232702419 iOS开发者公会-议事区   QQ群号:413102158

python3 UnicodeEncodeError错误,cx_oracle模块执行sql报错:UnicodeEncodeError: &#39;ascii&#39; codec can&#39;t encode characters in position

问题描述: 写了一个执行sql的模块,引用了cx_oracle,在windows机器上完美运行,移植到Centos上就会报错, UnicodeEncodeError: 'ascii' codec can't encode characters in position 检查过程: 代码编码为utf-8,print编码为utf-8,文件编码为utf-8,服务器编码为utf-8,各种正常 定位代码报错位置,开始怀疑是sql执行成功,返回值有中文报错,但是后来通过观察,是传入sql,并没有执行成功,执行

springboot x.x.x RELEASE pom 第一行报错解决办法

springboot x.x.x RELEASE pom 第一行报错解决办法 在pom.xml 文件的properties中加入maven jar插件的版本号 <properties> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version> </properties> 再在项目右键maven ,update project 更新项目即可 原文地址:https://www.cnblogs.com/Y