日期:2014-05-18  浏览次数:20652 次

煩人的sql大bug
我的程序在update的時候出現以下錯誤,想了很久,不知道問題出在那裡,我可是把插入的數據長度跟表定義的數據長度一一確認過的,結果還是出錯....
--------------------
java.sql.DataTruncation:   Data   truncation
at   net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:379)
at   net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2781)
at   net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2224)
at   net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:628)
at   net.sourceforge.jtds.jdbc.JtdsStatement.processResults(JtdsStatement.java:525)
at   net.sourceforge.jtds.jdbc.JtdsStatement.executeSQL(JtdsStatement.java:487)
at   net.sourceforge.jtds.jdbc.JtdsStatement.executeImpl(JtdsStatement.java:664)
at   net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1120)
at   net.sourceforge.jtds.jdbc.JtdsStatement.executeUpdate(JtdsStatement.java:1073)
at   webdb.web_data2.executeUpdate(web_data2.java:69)
at   _jsp._JavaWeb._eOA._market._new__jsp._jspService(/JavaWeb/eOA/market/new.jsp:43)
at   com.caucho.jsp.JavaPage.service(JavaPage.java:87)
at   com.caucho.jsp.JavaPage.subservice(JavaPage.java:81)
at   com.caucho.jsp.Page.service(Page.java:407)
at   com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:136)
at   com.caucho.server.http.Invocation.service(Invocation.java:268)
at   com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:128)
at   com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:333)
at   com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:266)
at   com.caucho.server.TcpConnection.run(TcpConnection.java:140)
at   java.lang.Thread.run(Thread.java:534)



------解决方案--------------------
不是bug,肯定是数据转换失败导致的Data truncation
------解决方案--------------------
似乎是数据类型出的问题
------解决方案--------------------
写繁文
------解决方案--------------------
Source code?
------解决方案--------------------
代码呢?
可以试一下改成最小长度。

------解决方案--------------------
中文问题?
------解决方案--------------------
LZ有点牛了,就列出个错误提示,人家怎么给你解决问题
连提问都不会
------解决方案--------------------
"字符被截断 "也算BUG?
牛人啊
------解决方案--------------------
不应该是bug,仔细找找,很多时候是自己的问题。。。。。。