When you use the mysql database to insert data, the question mark (?) appears (?) Problem, solution, mysql question mark
First, the mysql database I use is 5.7.12.
Problems:
1. Data insertion error. insertion failed. The following error occurs: Incorrect string value: '\ xCD \ xF5 \ xD5 \ xBC \ xBE \ xa9' for column 'sname' at row 1.
2. Chinese characters are inserted. Although the insertion is successful, the result is displayed as follows :??
Solution:
Add # character-set-server = utf8 to [mysqld] In the my. ini file
The content in the blue circle must be at the top of the blue circle, that is, the content in the blue circle must be at the bottom of [mysqld]; otherwise, the database cannot be logged on.
If the above solution still cannot be solved? Problems,
When connecting to the database, add? UseUnicode = true & characterEncoding = UTF-8. As follows:
"Jdbc: mysql: // localhost: 3306/sgmanagement? UseUnicode = true & characterEncoding = UTF-8 ";
Also on the Internet: Add # default-character-set = utf8 under [mysqld], but I didn't use it.
Feelings:
Now, of course, I am in a good mood. I spent 3 or 4 hours searching the Internet to find a lot of solutions, which is useless. Huang Tianyan did not suffer, and finally to try out.