A java.sql.SQLException is being thrown when JDBC attempts to convert a valid datetime in MySQL (5.1.51) to a java.sql.timestamp. An example is:
java.sql.SQLException: Cannot convert value '2012-04-05 10:20:00' from column 40 to TIMESTAMP
This is the first time
Versions:
MySQL: 5.1.51
J/Connector: 5.1.19
Column Definition: DATETIME
Java Type: java.sql.Timestamp
stack trace:
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)
DAO classes have not been modified recently. The only recent change on the server was upgrading MySQL from 5.1.46 to 5.1.51
You could disable Fast Date Parsing by adding useFastDateParsing=false to your JDBC connection URL. For example the following might solve your problem:
jdbc:mysql://yourHostName:3306/yourDbName?useUnicode=true&useFastDateParsing=false&characterEncoding=UTF-8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With