街边七号
2017-12-16 17:46
服务器启动,等待客户端连接
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'fcontent' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2983)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1604)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1504)
at com.socket.service.FileService.save(FileService.java:26)
at com.socket.socket.ServerThread.execute(ServerThread.java:66)
at com.socket.socket.ServerThread.run(ServerThread.java:31)
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'fcontent' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2983)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1604)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1504)
at com.socket.service.FileService.save(FileService.java:26)
at com.socket.socket.ServerThread.execute(ServerThread.java:67)
at com.socket.socket.ServerThread.run(ServerThread.java:31)
在MySQL中有四种Blob类型,他们的区别就是可以容纳的信息量不容分别是以下四种:
1.TinyBlob类型 最大能容纳255B的数据
2.Blob类型 最大能容纳65KB的
3.MediumBlob类型 最大能容纳16MB的数据
4.LongBlob类型 最大能容纳4GB的数据
很有可能是图片太大了,Blob容纳不了,可以换成MediumBlob类型,亲测有效。
去数据库把fcontent字段长度改长一点试试
Java Socket应用---通信是这样练成的
125013 学习 · 590 问题
相似问题