MySQL Cannot Convert Value ‘0000-00-00 00:00:00’ From Column XX To TIMESTAMP   Leave a comment

am in the middle of moving a lot of my datasources over to the updated Connector/J (JDBC)

One error I have seen a lot in my development enviorment is

view plain print about
1Error Executing Database Query.
2Cannot convert value ‘0000-00-00 00:00:00’ from column xxxx to TIMESTAMP.
This is caused by Java as it cannot handle zero dates (‘0000-00-00 00:00:00’), it trys to do anything it can with them but convert them to the original date :o). To get round this you can set a parameter in the JDBC URL called zeroDateTimeBehavior to convertToNull.

So in your Data Sources page you should have something similar to:

view plain print about
1jdbc:mysql://localhost:3306/mySqlDatabase?zeroDateTimeBehavior=convertToNull

Posted 2011年06月19日 by gw8310 in mysql

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: