81,092
社区成员
发帖
与我相关
我的任务
分享
HTTP Status 500 – Internal Server Error
--------------------------------------------------------------------------------
Type Exception Report
Message Request processing failed; nested exception is org.springframework.dao.RecoverableDataAccessException:
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.RecoverableDataAccessException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 2,329 milliseconds ago. The last packet sent successfully to the server was 2,328 milliseconds ago.
### The error may involve org.neolyao.stu.dao.GradeDAO.updateGrade-Inline
### The error occurred while setting parameters
### SQL: update grade set grades=? where st_id=? and c_id=?
### Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 2,329 milliseconds ago. The last packet sent successfully to the server was 2,328 milliseconds ago.
; SQL []; Communications link failure
The last packet successfully received from the server was 2,329 milliseconds ago. The last packet sent successfully to the server was 2,328 milliseconds ago.; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 2,329 milliseconds ago. The last packet sent successfully to the server was 2,328 milliseconds ago.
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Root Cause
org.springframework.dao.RecoverableDataAccessException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
<update id="updateGrade" parameterType="org.neolyao.stu.bean.Grade">
update grade
set grades=#{grade}
where st_id=#{st_id} and c_id=#{c_id}
</update>
<delete id="deleteGradeById" parameterType="org.neolyao.stu.bean.Grade" >
delete from grade where st_id=#{st_id} and c_id=#{c_id}
</delete>
<update id="updateGrade" parameterType="org.neolyao.stu.bean.Grade">
update grade
set grades=#{grade,jdbcType=TINYINT}
where st_id=#{st_id,jdbcType=VARCHAR} and c_id=#{c_id,jdbcType=VARCHAR}
</update>
改成这样了,还是一样的,我试了下delete能正常执行[/quote]
为什么你set grades传入的值名字,和数据库的表名一致?这样你的sql会没有问题・_・?[/quote]
我终于找到原因了, 我的表名 和 表的一个列名相同了都是grade,我把表名改了就对了。谢了兄弟
<delete id="deleteGradeById" parameterType="org.neolyao.stu.bean.Grade" >
delete from grade where st_id=#{st_id} and c_id=#{c_id}
</delete>
<update id="updateGrade" parameterType="org.neolyao.stu.bean.Grade">
update grade
set grades=#{grade,jdbcType=TINYINT}
where st_id=#{st_id,jdbcType=VARCHAR} and c_id=#{c_id,jdbcType=VARCHAR}
</update>
改成这样了,还是一样的,我试了下delete能正常执行[/quote]
为什么你set grades传入的值名字,和数据库的表名一致?这样你的sql会没有问题・_・?