错误出现:

含有错误的查询后,选中insert语句无法执行,报错current transaction is aborted, commands ignored until end of transaction block

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

分析:

事务中含有错误,再执行DML时,事务无法正常进行。

解决方法:

1.尝试connection.setAutoCommit(true);无法执行

2.直接commit ,提交后再执行insert语句,成功插入。

 

参考了stackoverflow的解法:

https://stackoverflow.com/questions/10399727/psqlexception-current-transaction-is-aborted-commands-ignored-until-end-of-tra

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄