ledru cyril wrote:
> Hello,
>
> I have the same problem with Connector Java 3.1.6
> :
>
> java.sql.SQLException: Cannot convert value
> '0000-00-00 00:00:00' from column 2 to TIMESTAMP.
> at
> com.mysql.jdbc.ResultSet.getTimestampFromString(Re
> sultSet.java:6369)
> at
> com.mysql.jdbc.ResultSet.getStringInternal(ResultS
> et.java:2161)
> at
> com.mysql.jdbc.ResultSet.getString(ResultSet.java:
> 2076)
>
> => but i have not problem with Connector Java
> 3.0.16
>
> Have you a solution at this problem ?
>
> Cyril.
Cyril,
Always a good idea to read the CHANGELOG (in the appendix at the end of the doc, or in the CHANGES file that comes with your driver) when you upgrade, as it contains information like this:
"Added three ways to deal with all-zero datetimes when reading them from
a ResultSet, 'exception' (the default), which throws a SQLException
with a SQLState of 'S1009', 'convertToNull', which returns NULL instead of
the date, and 'round', which rounds the date to the nearest closest value
which is '0001-01-01'."
The configuration parameter is 'zeroDateTimeBehavior' and there's more detail in the docs at:
http://dev.mysql.com/doc/connector/j/en/cj-driver-classname.html
We had to make the change to be JDBC and SQL-compliant (which doesn't allow silent conversion of all-zero datetimes).
-Mark
Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools
Oracle
http://www.mysql.com/products/enterprise/monitor.html