Recently, I was learning the orm framework, the fields in the inserted objects contained Chinese characters, and I found that the Chinese fields in the database table were ???
Solution process:
- The url value is changed from jdbc:mysql://localhost:3306/test to jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf-8
- Change the project encoding format to utf8
- Query current database character encoding SHOW VARIABLES LIKE "character%";
- found | character_set_database and character_set_server are latin1
- set in my.ini
- default-character-set=utf8
- character-set-server=utf8
- restart mysql service
- The encoding format was not specified as utf8 when the table was built before, and the table was rebuilt
-
CREATE TABLE bobo_user ( user_id varchar(100), username varchar(30) , nickname varchar(30), phone_number varchar(30) , password varchar(30), PRIMARY KEY (user_id) ) DEFAULT CHARSET=utf8;
-
problem solved