SSM-物流管理常見問題1Data truncation: Incorrect datetime value: '' for column 'posttime' at row 1


HTTP Status 500 – Internal Server Error


Type Exception Report

Message Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException:

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.dao.DataIntegrityViolationException: 
### Error updating database.  Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'posttime' at row 1
### The error may involve com.dzx.express.mapper.ExpressMapper.insertSelective-Inline
### The error occurred while setting parameters
### SQL: insert into express      ( id,                       fromlocation,                       tolocation,                       phone,                       posttime,                       type )       values ( ?,                       ?,                       ?,                       ?,                       ?,                       ? )
### Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'posttime' at row 1
; SQL []; Data truncation: Incorrect datetime value: '' for column 'posttime' at row 1; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '' for column 'posttime' at row 1
	org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:973)
	org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
	org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
	org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)


翻了很多的原因,最開始懷疑是數據庫和代碼的utf-8不匹配,排除了,又懷疑是時間類型沒有用轉換器,排除了。最后看見了一篇博客說mysql的jar包版本可能不對,試了一下,成功了,
我的之前的jar包是mysql-connector-java-5.0.4-bin.jar換成了mysql-connector-java-5.1.7-bin.jar

就可以正常運行了



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM