mysql datetime查詢異常 異常:Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp (2011-05-25 11:38:40) 描述:非空無預設值的Datetime類型欄位,查詢時程式報以下錯誤 ...
mysql datetime查詢異常
- 異常:Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp (2011-05-25 11:38:40)
- 描述:非空無預設值的Datetime類型欄位,查詢時程式報以下錯誤: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp
- 解決方法:資料庫連接串添加zeroDateTimeBehavior參數或者noDatetimeStringSync參數jdbc:mysql://host:port/xxx?...
- zeroDateTimeBehavior:取值exception、converToNull、round
-
-
- exception---拋出異常:結果java.sql.SQLException: Value '0000-00-00 00:00:00' can not be represented as java.sql.Timestamp。
- converToNull:返回null值
- round:返回0001-01-01 00:00:00.0
-
-
- noDatetimeStringSync:設置為true,返回0000-00-00 00:00:00