transation专题

Could not retrieve transation read-only status server

背景 最近在部署一套完整的项目,部署过程中遇到很多的问题,在来总结一些如标题的这个错误! 环境说明: 使用分布式数据库,使用的是mysql! ### Cause: java.sql.SQLException: Could not retrieve transation read-only status server; SQL []; Could not retrieve transatio

(20210316已解决)postgresql cannot execute CREATE TABLE in a read-only transation

Overview 如题,在一个postgresql 的docker container里创建数据库出现上述错误。 Solution Normally the most plausible reasons for this kinde of error are: trying create statements on a read-only replica (the entire instanc

Transation-多数据源下解决同一个方法多数个事务问题

前言 在最近的工作中,公司要把以前php写的代码先一部分转为java,里面在一个方法里面需要对多个数据源进行事务的管理。在这篇文章里面我会介绍一些自己在解决这个问题时的一些思路和我的解决办法。 问题引入: 由于是定时任务,需要在同一个方法里面对多个数据源进行操作,但是因为是不同数据源因此使用事务的会发现会报错。 public int addWithTransation() {int cur