It's written here [MySQL, how to insert null dates ] that MySQL support NULL in datetime field. I am doing this with Java and get next error:
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: 'NULL' for column 'lastvisited' at row 1
If I run in phpmyadmin:
UPDATE `linksbase` SET `lastvisited`=NULL WHERE 1
It is updated.
What is the problemw ith Java code?
prepareStatement("INSERT INTO `linksbase` (`lastvisited`) VALUES ('NULL')");
If I change statement to
prepareStatement("INSERT INTO `linksbase` (`lastvisited`) VALUES (NULL)");
Error is
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'lastvisited' cannot be null