mysql datetime查詢異常問題解決,mysqldatetime查詢
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
感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!