Start a new topic

Error when date field is null

[This topic is migrated from our old forums. The original author name has been removed]

I am seeing errors in DBVisualizer (nothing stopping things from working) when my date fields are set to null (allowed in my schema). DB is Mysql 5.1.65 and the field is defined as date (not date-time) Error showing in the client is java.sql.SQLException: Value '0000-00-00' can not be represented as java.sql.Date Connection info is Product: DbVisualizer Pro 9.0.5 Build: #1924 (2013/03/05 13:16) Java VM: Java HotSpot(TM) 64-Bit Server VM Java Version: 1.7.0_17 Java Vendor: Oracle Corporation OS Name: Windows 7 OS Arch: amd64 OS Version: 6.1 Current profile: mysql Current facade: mysql MySQL 5.1.65-log MySQL-AB JDBC Driver mysql-connector-java-5.1.21 ( Revision: ${bzr.revision-id} )

[This reply is migrated from our old forums.]

Re: Error when date field is null
Hi Doug, Are you sure the value is null? The message should only be displayed when the value is all zeros. Anyway, you can try setting the "zeroDateTimeBehavior" driver property to "convertToNull" in the Properties tab for the connection. See this page for details about the property: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]
[Attachment has been removed.]

Re: Error when date field is null
Thanks Hans, Yes I am sure, Here is a screen shot of the output I was seeing before setting the property (changing it fixed the issue). Thanks again
[This reply is migrated from our old forums.]

Re: Error when date field is null
Hi Doug, Glad to hear it solved the problem. Just note that the value is shown as null in the grid even if it's all zeros because of the exception, so you can't tell from the screenshot. Best Regards, Hans