First, the MySQL database I used was version 5.7.12.
Problems that arise:
1. Insert data display error, insert unsuccessful, appears: incorrect string value: ' \XCD\XF5\XD5\XBC\XBE\XA9 ' for column ' Sname ' at row 1
2. Insert Chinese, although inserted successfully, but display:??
Workaround:
Add #character in [mysqld] in the My.ini file-set-server=utf8
, must be above the blue circle, that is, the contents of the blue circle must be at the bottom of [mysqld], or the database cannot be logged in at all.
If the above solution is not solved? The problem,
When connecting to a database add the word useunicode=true&characterencoding=utf-8. As shown below:
"Jdbc:mysql://localhost:3306/sgmanagement?useunicode=true&characterencoding=utf-8";
Online also said: "In [mysqld] to add #default-character-set=utf8, but I do not use."
Feel:
Now of course the mood is joyful, spent 3, 4 hours on the internet to check a lot of solutions, are useless. Emperor not to bear the painstaking people, finally to try out.
Using the MySQL database, insert the data with a question mark (? ) Problem, workaround