MySQL, JDBC Driver and zero dates
I 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
1 Error Executing Database Query.<br/>
2 Cannot 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:
2 Cannot convert value '0000-00-00 00:00:00' from column xxxx to TIMESTAMP.
1 jdbc:mysql://localhost:3306/mySqlDatabase?zeroDateTimeBehavior=convertToNull
TweetBacks
Data -> Services -> Datasources -> MySQL(4/5)
Advanced Settings
Add: zeroDateTimeBehavior-convertToNull
to the Connection String Field
Thanks for the tip! Solved my issues too!
Good Work!
added...
zeroDateTimeBehavior=convertToNull
...to the connection string field in the CF8 admin for the MySQL4/5 DSN
Solved!