当JDBC尝试将MySQL(5.1.51)中的有效日期时间转换为java.sql.timestamp时,将抛出java.sql.sqlException.一个例子是:
java.sql.sqlException: Cannot convert value '2012-04-05 10:20:00' from column 40 to TIMESTAMP
这是第一次
Versions:
MysqL: 5.1.51
J/Connector: 5.1.19
Column Definition: DATETIME
Java Type: java.sql.Timestamp
堆栈跟踪:
Cannot convert value '2012-04-05 10:20:00' from column 40 to TIMESTAMP.
at com.MysqL.jdbc.sqlError.createsqlException(sqlError.java:1073)
at com.MysqL.jdbc.sqlError.createsqlException(sqlError.java:987)
at com.MysqL.jdbc.sqlError.createsqlException(sqlError.java:982)
at com.MysqL.jdbc.sqlError.createsqlException(sqlError.java:927)
at com.MysqL.jdbc.ResultSetRow.getTimestampFast(ResultSetRow.java:1335)
at com.MysqL.jdbc.BufferRow.getTimestampFast(BufferRow.java:576)
at com.MysqL.jdbc.ResultSetImpl.getTimestampInternal(ResultSetImpl.java:6466)
at com.MysqL.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:6066)
at com.MysqL.jdbc.ResultSetImpl.getTimestamp(ResultSetImpl.java:6104)
at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:300)
at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:300)
at org.apache.tomcat.dbcp.dbcp.DelegatingResultSet.getTimestamp(DelegatingResultSet.java:300)
最佳答案