java.sql.SQLException: Incorrect string value: '\xE5\x90\x88\xE8\xAE\xA1' for column

大部分是因为字符集不兼容造成的,解决办法就是修改mysql client和server的字符集, 修改字符集的办法之一是修改C:\Program Files (x86)\MySQL\MySQL Server 6.0\my.ini

中client和server的字符集都设成gb2312    即 default-character-set=gb2312。 然后重启mysql service和client


mysql> status;
--------------
C:\Program Files (x86)\MySQL\MySQL Server 6.0\bin\mysql.exe  Ver 14.13 Distrib 6.0.2-alpha, for Win32 (ia32)

Connection id:          1
Current database:
Current user:           root@localhost
SSL:                    Not in use
Using delimiter:        ;
Server version:         6.0.2-alpha-community-nt-debug MySQL Community Server (GPL)
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    gb2312
Db     characterset:    gb2312
Client characterset:    gb2312
Conn.  characterset:    gb2312
TCP port:               3306
Uptime:                 16 sec

Threads: 1  Questions: 4  Slow queries: 0  Opens: 14  Flush tables: 1  Open tables: 7  Queries per second avg: 0.250


你可能感兴趣的:(java.sql.SQLException: Incorrect string value: '\xE5\x90\x88\xE8\xAE\xA1' for column)