Question

Production CentOS 6.5 server told me to upgrade to MariaDB from MySQL. I now realise that there may not be a version of MariaDB ready for commercial use.

Now I have a problem where timestamp fields randomly changes to 0000-00-00 00:00:00 (or null??). It might happen on one of every 100 records. I only ever create a timestamp using CURRENT_TIMESTAMP at record creation.

In MySQL JDBC connector I had set the zeroDateTimeBehaviour=null for some reason. This setting is not available in MariaDB JDBC connector.

Was it helpful?

Solution

If you are using different connector then you need to use the mariadb driver for sure (also change JDBC connection string)

check https://mariadb.com/kb/en/mariadb/about-the-mariadb-java-client/

Please note that the driver class provided by the MariaDB Client Library for Java Applications is not com.mysql.jdbc.Driver but org.mariadb.jdbc.Driver!

updating timestamp will not work otherwise and when update or insert fails you get the 0000-00-00 00:00:00

I had this same problem when switching from MySQL to MariaDB...

OTHER TIPS

It depends on values, here you can find some probable reasons: mariadb - timestamp

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top