因为我再spring 中使用了AOP进行事务管理,有如下配置

<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!-- 定义事务传播属性 -->
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="edit*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="new*" propagation="REQUIRED" />
<tx:method name="set*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="change*" propagation="REQUIRED" />
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="load*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" propagation="REQUIRED" read-only="true" />
</tx:attributes>
</tx:advice>

对于get find load 开头和其他所有方法都设置了只读,不能修改、删除、插入 操作。而我执行的方法名以Insert 开头大小写不一致导致当前事务是只读的,执行插入操作就会报以上错误。

Connection is read-only. Queries leading to data modification are not allowed 错误原因的更多相关文章

  1. [Done]java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

    java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed ...

  2. java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed

    org.springframework.dao.TransientDataAccessResourceException: ### Error updating database. Cause: ja ...

  3. 执行update操作的话,就会报“Connection is read-only. Queries leading to data modification are not allowed”的异常。

    我用的是 spring + springmvc + mybatis +mysql. <tx:advice id="txAdvice" transaction-manager= ...

  4. Connection is read-only. Queries leading to data modification are not allowed

    看了下mysql-connector-5.1.40版本中,如果设置failoverReadOnly=true (即默认值,参考链接),当mysql连接failover时,会根据jdbc连接串将当前连接 ...

  5. java最全的Connection is read-only. Queries leading to data modification are not allowed

    Connection is read-only. Queries leading to data modification are not allowed 描述:框架注入时候,配置了事物管理,权限设置 ...

  6. 详细解读 :java.sql.SQLException: Connection is read-only. Queries leading to data modification are not allowed,Java报错之Connection is read-only.

    问题分析: 实际开发项目中,进行insert的时候,产生这个问题是Spring框架的一个安全权限保护方法,对于方法调用的事物保护,一般配置如下: <!-- 事务管理 属性 --> < ...

  7. 执行新增和修改操作报错connection is read-only. Queries leading to data modification are not allowed

    出现这个问题的原因是默认事务只有只读权限,因此要添加下面的每一个add*,del*,update*等等. 分别给予访问数据库的权限. 方法名的前缀有该关键字设置了read-only=true,将其改为 ...

  8. Chapter Data Modification & Chapter Data Validation

    Chapter Data Modification XF的数据提交,支持单行.集合和多层次的master-details结构的数据. Create 当提交如下数据 <Job> <Id ...

  9. System.Data.OleDb.OleDbException: 未指定的错误的解决方法

    异常详细信息: System.Data.OleDb.OleDbException: 未指定的错误 这个错误是access数据库特有的错误,当access频繁读取或操作过多的时候就会发生这个错误,微软官 ...

随机推荐

  1. k8s-强制删除pod

    kubectl get deployments --all-namespaces [root@master ~]# kubectl get deployments --all-namespacesNA ...

  2. marquee跑马灯效果的相关属性

    介绍HTML设置滚动文字marquee的相关属性 ㈠文字滚动标签 设置文字滚动使用<marquee></marquee>标签,可以再标签里面设置字体的颜色,字号,字体大小等. ...

  3. List集合遍历的三种方法

    测试数据: List<String> list = new ArrayList<String>(); list.add("java"); list.add( ...

  4. Ubuntu下搜狗输入法乱码(二)

    本文适用于Ubuntu 16.04,造冰箱的大熊猫@cnblogs 2018/10/25 搜狗输入法时不时出现候选字乱码的问题.参照网上所说的修改Fcitx配置中的简体中文和繁体中文转换配置的方法,无 ...

  5. 翻页的时候更改URL地址

    要求点击第一页是url+p1html,点击第二页是url+p2html等等 $("body").on('click','#w_tagPage a[wid]',function(){ ...

  6. selenium实现chrome分屏截图的合并

    selenium的截图功能在chrome下无法实现,但是可以操作滚动条来一屏一屏的截图,然后再合并成一张图,合并图片的代码在网上找的,十分感谢那位朋友,具体解决方案如下:直接上代码: def capt ...

  7. github版本库使用详细教程

    GitHubGit 教程[1] 同学们,上课了!今天我们来学习github的使用,我们将用它来管理我们的代码,你会发现它的好处的,当然是要在本系列教程全部完成之后,所以请紧跟站长的步伐,今天是第一天, ...

  8. Ubuntu18.04安装rabbitvcs svn图形化客户端和简单实用

    1.1  自带source源里面查找rabbitvcs信息 sudo apt search rabbitvcs 1.2  安装rabbitvcs sudo apt install rabbitvcs- ...

  9. ping不通服务器就邮件警告

    ping不通服务器就发一封邮件 (单台) vim /root/scipt/1.sh #!/bin/bash ping -c 4 192.168.0.116 &> /dev/null #p ...

  10. 自定义实现Java动态代理

    转自:https://www.cnblogs.com/rjzheng/p/8750265.html 一 借助JDK的API实现: 1.先创建一个接口,并实现它 public interface Per ...