java.sql.SQLException: Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '=
2010-06-09 11:19
696 查看
java.sql.SQLException: Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1120)
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:675)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1027)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at com.ericliu.DAO.UserManagerDAO.validateProductUser(UserManagerDAO.java:233)
at com.ericliu.service.UserValidateService.validateLogIn(UserValidateService.java:52)
at com.ericliu.service.UserValidateService.main(UserValidateService.java:69)
恶心的错误;
解决方法:
1、词序集错误----修改数据库中表中相应字段的词序一致
2、用introducer指定文本字符串的字符集:
– 格式为:[_charset] 'string' [COLLATE collation]
比如"select * from productuser p where p.username = ? and p.password = ?";
修改为:
"select * from productuser p where p.username = _utf8 ? COLLATE utf8_general_ci and p.password = _utf8 ? COLLATE utf8_general_ci ";
Got it!
FK!
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2926)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1120)
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:675)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1027)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93)
at com.ericliu.DAO.UserManagerDAO.validateProductUser(UserManagerDAO.java:233)
at com.ericliu.service.UserValidateService.validateLogIn(UserValidateService.java:52)
at com.ericliu.service.UserValidateService.main(UserValidateService.java:69)
恶心的错误;
解决方法:
1、词序集错误----修改数据库中表中相应字段的词序一致
2、用introducer指定文本字符串的字符集:
– 格式为:[_charset] 'string' [COLLATE collation]
比如"select * from productuser p where p.username = ? and p.password = ?";
修改为:
"select * from productuser p where p.username = _utf8 ? COLLATE utf8_general_ci and p.password = _utf8 ? COLLATE utf8_general_ci ";
Got it!
FK!
相关文章推荐
- java.sql.SQLException: Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='
- Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
- 解决Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (gbk_chinese_ci,COERCIBLE) for operatio
- Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (gbk_chinese_ci,COERCIBLE) for operation '=' 一个解决办法
- MySQL Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (utf8_general_ci,IMPLICIT) for operation 'UNION' 错误解决方法
- Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (gbk_chinese_ci,COERCIBLE) for operation
- java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,C
- java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=' 异常处理,及MySQL数据库编码设置
- Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation 'like'
- Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (gbk_chinese_ci,COERCIBLE) for operation '=' 一个解决办法(转载)
- Mybatis学习中遇到的错误java.sql.SQLException: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (ut
- Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT)错误的解决方案
- MYSQL错误:Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
- 解决Mysql:Illegal mix of collations (gbk_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '='
- MySql中出现 Illegal mix of collations (latin1_swedish_ci,COERCIBLE) and (gbk_chinese_ci,COERCIBLE) for
- mysql错误:Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
- Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (gbk_chinese_ci,COERCIBLE) for operation
- Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation
- Illegal mix of collations (gb2312_chinese_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE)
- Illegal mix of collations (latin5_turkish_ci,IMPLICIT) and (gb2312_chinese_ci,COERCIBLE) for operati