Symptom: Use JDBC to insert Chinese fields into the MySQL database, and then open the table to find that the fields are all quot ;?? Quot;, or garbled. Cause: 1. It is not specified during database creation
Symptom: Use JDBC to insert Chinese fields into the MySQL database, and then open the table to find that the fields are all quot ;?? Quot;, or garbled. Cause: 1. It is not specified during database creation
Symptom: Use JDBC to insert Chinese fields into the MySQL database, and then open the table to find that the fields are all "?? ", Or garbled.
Cause:
1. The default encoding method is not specified when you create a database. As a result, the database uses the default Character Set latin1 of MySql.
2. The Client character set is latin1.
3. Unmatched character sets are used for jdbc links.
Solution:
1. When creating a database, specify the default Character Set of the database as utf8. SQL statement not found...
2. Modify the default Character Set of the Client to utft. In windows, find my In the mysql installation directory. ini, change default-character-set = latin1 to default-character-set = UTF8, then restart the mysql service to change the default Character Set of the database to utf8. at this time, use the \ s command on the mysql command line to check whether the character set has been changed.
3. Modify the jdbc link to change the original
Jdbc: mysql: // localhost: 3306/YourDb
Change
Jdbc: mysql: // localhost: 3306/YourDb? UseUnicode = true & characterEncoding = UTF-8
After completing the above work, the Chinese characters inserted into mysql should not be garbled.