DataBase将错误链接到应用程序

时间:2018-05-27 04:50:37

标签: java mysql database varchar

我一直在尝试运行我的项目,这是一个Web应用程序,它将excel表作为输入并处理数据。直到最近,执行工作进展顺利,但只是在今天早上我得到以下错误,请帮助

PoolingDAO中的异常==> insertClass():

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'item_codes' at row 1
at com.mysql.jdbc.PreparedStatement.executeInternal 
at com.mysql.jdbc.PreparedStatement.executeUpdate
at com.mysql.jdbc.PreparedStatement.executeUpdate   
at com.Fidoop.DAOFactory.PoolingDAO.insert_to_mbill(PoolingDAO.java:471)
at com.Fidoop.util.GetInvoiceRead.Itemlistread(GetInvoiceRead.java:63)
at com.action.user.UploadFileMaster.doPost(UploadFileMaster.java:291)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
at org.apache.catalina.core.ApplicationFilterChain.doFilter
at org.apache.catalina.core.StandardWrapperValve.invoke
at org.apache.catalina.core.StandardContextValve.invoke
at org.apache.catalina.authenticator.AuthenticatorBase.invoke
at org.apache.catalina.core.StandardHostValve.invoke
at org.apache.catalina.valves.ErrorReportValve.invoke
at org.apache.catalina.valves.AccessLogValve.invoke
at org.apache.catalina.core.StandardEngineValve.invoke
at org.apache.catalina.connector.CoyoteAdapter.service
at org.apache.coyote.http11.AbstractHttp11Processor.process
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3489)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1936)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2060)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2542)
at java.lang.Thread.run(Unknown Source)

创建新连接 矢量:[com.mysql.jdbc.JDBC4Connection@75c5a4] 破坏连接 删除重复的单词:

1 个答案:

答案 0 :(得分:0)

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'item_codes' at row 1

此错误来自MySQL,因为您尝试保留的内容对于给定字段item_codes来说太大了。您有几种方法可以缓解此问题

  • 该表上的字段长度*
  • 调整电子表格中的字符长度
  • 以编程方式修剪输入的长度。