java.sql.SQLException: Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (gbk_chinese_ci,COERCIBLE) for operation '='
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
<!-- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> -->
2.数据库连接设置为 utf8编码 <?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_member = "localhost";
$database_member = "member";
$username_member = "root";
$password_member = "123456";
$member = mysql_pconnect($hostname_member, $username_member, $password_member) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_query("set names gbk");
?>
请修改为 mysql_query("set names utf8");
请注意php和MYSQL编码发送相同问题。与MYSQL数据库编码无关
jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=GBK
jdbc:mysql://localhost:3306/news?useUnicode=true&characterEncoding=GBK