qq_38584967
jianhaojiang
采纳率0%
2017-05-19 15:13 阅读 4.8k

mysql数据库decimal(5,2)的sql语句更新问题

求助mysql数据库decimal(5,2)的sql语句更新问题,本人菜鸟,刚学。

我在数据库建了一个成绩表,然后成绩是用的decimal(5,2)存储的
,然后我在进行sql语句更新的时候懵逼了。我用PreparedStatement对象更新。然后我那个变量是double类型的。执行就报错了,就是把double类型的给予decimal类型错误,但是数据还是更新出来了。
请问怎样才能解决这个问题(或者说不让eclipse报错,因为数据确实能更新)。
pStmt.set...(,)我找不到装换为decimal类型的。求助

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • qq_38584967 jianhaojiang 2017-05-19 15:20

    这是报的错
    严重:
    Servlet.service() for servlet [jsp] in context with path [/testS] threw exception [java.lang.NumberFormatException: null] with root cause
    java.lang.NumberFormatException: null
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at org.apache.jsp.resultAmend_jsp._jspService(resultAmend_jsp.java:156)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:958)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)

    点赞 评论 复制链接分享
  • qq_38584967 jianhaojiang 2017-05-20 02:37

    抱歉,错误已经解决了,decimal是可以接受double类型的。报错不是因为这个。我在更新后的重定向去的页面我忘了传值了。实在是马虎

    点赞 评论 复制链接分享

相关推荐