进行数据库(mysql5.0)查询时出现如下异常:
nested exception is java.sql.SQLException: Unknown type '246 in column 1 of 3 in binary-encoded result set.
之所以这里又重申了一下,是因为网上说 :"当Mysql 5.0表数据类型设计为DECIMAL时,在spring,hibernate项目运行会出现246错误: " 貌似我没有这个问题.我的查询语句如下:
String sql = "select a.contentId,sum(if(rs.id is null,0,1)),ifnull(rs.sm,0) " +
"from (select w.contentId id,sum(if(w.contentId is null,0,1))sm " +
"from wapcontent w,wapuserdownlog l " +
"where w.contentId=l.ContentID " +
"group by w.contentId) rs " +
"right join useraccesslog a on rs.id=a.contentId " +
"group by a.contentId order by sum(if(rs.id is null,0,1)) desc";
出现此结果,网上还有一种说法说是 mysql的jar包过低,低于3.0.17就会有此问题,但是我的是3.1.7的(appfuse+webwork1.8.2 默认包版本),不过最终问题的确是包的问题,当我将项目的包替换为mysql-connector-java-5.0.3bin.jar 之后,该问题不再出现