Mysql代码
mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
然后设置
set character_set_connection=gbk;
set character_set_client=gbk;
set character_set_results=gbk;
在数据链接那层,加上
jdbc:mysql://127.0.0.1:3306/demo?useUnicode=true&characterEncoding=gbk