项目采用腾讯TSF框架,数据库为TDSQL,在执行数据保存时,报错如下:
"Could not commit JDBC transaction; nested exception is java.sql.SQLException: Got an error in state of 'preparing', transaction aborted, xid='4-46-9303eaf-60ada4a8-2a', errmsg='You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'XA COMMIT '4-46-9303eaf-60ada4a8-2a' ONE PHASE' at line 1'",
此问题排查了2天,最后发现数据库连接url中有一个sql批处理优化的配置:
rewriteBatchedStatements=true
翻阅TDSQL文档,发现此配置并不支持TDSQL,只支持Mysql,故去除该配置,成功解决此问题。