1、
“com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.”
String url = "jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=gbk&autoReconnect=true";
红色内容加上就可以了
HTML实体的表现方式,是以位与运算符&开头,以分号运算符;结尾.
下面是经常用到的,最重要的实体,而且是在HTML标签或属性中使用的.
" -- 表示双引号(“)
& -- 表示位与运算符(&)
< -- 表示小于运算符(<)
> -- 表示大于运算符(>)
-- 表示空格( )
2、
java.sql.SQLException: Before start of result setat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:842)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2673)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2814)
at com.tanke.main.dao.TotalDao.main(TotalDao.java:111)
java.sql.SQLException: Before start of result set
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
at com.mysql.jdbc.ResultSetImpl.checkRowPos(ResultSetImpl.java:842)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2673)
at com.mysql.jdbc.ResultSetImpl.getInt(ResultSetImpl.java:2814)
at com.tanke.main.dao.TotalDao.main(TotalDao.java:111)
出现这种问题的原因是,去数据库中的内容时,没有执行rs.next(),就取rs.getInt("sum");
解决方案:
while(rs.next()){
int sum = rs.getInt("sum");
}
3、
com.XXX.persistence.DataAccessException: execute error:
--- The error occurred in conf/ibatis/bondall.ibatis.xml.
--- The error occurred while applying a result map.
--- Check the PlatformBondAll.PlatformBondAll.
--- Check the result mapping for the 'createTime' property.
--- Cause: java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 4 to TIMESTAMP.