When inserting null data into the database, the error message Data truncation: Data too long for column 'REPLY_TYPE' at row 1, this field is set to varchar(20), and the character set of the program and table is utf_8
PHP中文网2017-05-25 15:10:09
Try, jdbc:mysql://xxx.xxx.xxx.xxx:3306/xxxxxx?useUnicode=true&characterEncoding=utf8
Guarantee: database, tables, fields, program encoding, and jdbc connection are all utf-8
伊谢尔伦2017-05-25 15:10:09
I was all in tears. I finally found out. It was because the order of my database fields was inconsistent with the order of insertion in the java code. Long ones were inserted into character types and short ones were restricted.
insert into table name values (?,?) is a must. The order is consistent with the fields in the table
insert into table name (field name, field name) values (?,?) This order can be inconsistent
I guess it is only a novice like me who makes this mistake