标签:
mybatis突然查不到数据,查询返回的都是Null,但是 select count(*) from xxx查询数量,返回却是正常的。
Preparing: SELECT id,a9004,a9005,a9015 FROM a90 where a9010 = ? ORDER BY id LIMIT 1
[DEBUG] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139):http-bio-8080-exec-7 - ==> Parameters: 科技评论(String)
[DEBUG] org.apache.ibatis.logging.jdbc.BaseJdbcLogger.debug(BaseJdbcLogger.java:139):http-bio-8080-exec-7 - <== Total: 0
但是将sql :
SELECT id,a9004,a9005,a9015 FROM a90 where a9010 = ‘科技评论‘ ORDER BY id LIMIT 1
在mysql.exe中直接执行,却是有结果的。
后来发现是乱码问题,在数据库连接上指定字符编码就行了:
?autoReconnect=true&useUnicode=true&characterEncoding=utf8
标签:
原文地址:http://www.cnblogs.com/digdeep/p/5801095.html