【概述】 场景 + 问题概述
执行一条查询sql
INSERT INTO bdp_version_proc_rel ( version_id, proc_id, all_copy_data_json ) VALUES ( ?, ?, ? )

【应用框架及开发适配业务逻辑】

【问题】 当前遇到的问题
业务代码执行一条sql报错了

Error updating database. Cause: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (70,199,179 > 67,108,864). You can change this value on the server by setting the ‘max_allowed_packet’ variable.

2021/10/21 下午2:32:37 ### The error may involve cn.getech.data.development.mapper.BdpVersionProcRelMapper.insert-Inline

2021/10/21 下午2:32:37 ### The error occurred while setting parameters

2021/10/21 下午2:32:37 ### SQL: INSERT INTO bdp_version_proc_rel ( version_id, proc_id, all_copy_data_json ) VALUES ( ?, ?, ? )

2021/10/21 下午2:32:37 ### Cause: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (70,199,179 > 67,108,864). You can change this value on the server by setting the ‘max_allowed_packet’ variable.

2021/10/21 下午2:32:37 ; Packet for query is too large (70,199,179 > 67,108,864). You can change this value on the server by setting the ‘max_allowed_packet’ variable.; nested exception is com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (70,199,179 > 67,108,864). You can change this value on the server by setting the ‘max_allowed_packet’ variable.

2021/10/21 下午2:32:37 org.springframework.dao.TransientDataAccessResourceException:

2021/10/21 下午2:32:37 ### Error updating database. Cause: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (70,199,179 > 67,108,864). You can change this value on the server by setting the ‘max_allowed_packet’ variable.

2021/10/21 下午2:32:37 ### The error may involve cn.getech.data.development.mapper.BdpVersionProcRelMapper.insert-Inline

2021/10/21 下午2:32:37 ### The error occurred while setting parameters

2021/10/21 下午2:32:37 ### SQL: INSERT INTO bdp_version_proc_rel ( version_id, proc_id, all_copy_data_json ) VALUES ( ?, ?, ? )

2021/10/21 下午2:32:37 ### Cause: com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (70,199,179 > 67,108,864). You can change this value on the server by setting the ‘max_allowed_packet’ variable.

2021/10/21 下午2:32:37 ; Packet for query is too large (70,199,179 > 67,108,864). You can change this value on the server by setting the ‘max_allowed_packet’ variable.; nested exception is com.mysql.cj.jdbc.exceptions.PacketTooBigException: Packet for query is too large (70,199,179 > 67,108,864). You can change this value on the server by setting the ‘max_allowed_packet’ variable.

2021/10/21 下午2:32:37 at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:110)

2021/10/21 下午2:32:37 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)

2021/10/21 下午2:32:37 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)

2021/10/21 下午2:32:37 at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81)

【TiDB 版本】
5.7.25-TiDB-v5.2.1