I have meet following problem in logs.
java.sql.BatchUpdateException: Packet for query is too large (2542834 > 1048576).
You can change this value on the server by setting the max_allowed_packet' variable.
at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1666)
at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1082)
Solution is to change value 'max_allowed_packet' in mysql. It could be done in few ways:
- change value in command line
- setup value in configuration file 'my.cnf'
- set value in startup property
- change value in configuration table
let me briefly describe some of these options
add 3)
start mysql with following property:
mysqld --max_allowed_packet=32M
then restart mysql service.
add 4)
mysql -u root -p<password>
show variables like 'max_allowed_packet';
+--------------------+---------+
| Variable_name | Value |
+--------------------+---------+
| max_allowed_packet | 1048576 |
+--------------------+---------+
1 row in set (0.00 sec)
set global max_allowed_packet = 15000000;
Please note that this change is visible and applied to all new JDBC connection.
No comments:
Post a Comment