Exception in thread "main" com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'note' at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2868)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.ServerPreparedStatement.serverExecute(ServerPreparedStatement.java:1169)
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:693)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1404)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1318)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1303)
at MyPrepare.main(MyPrepare.java:87)

原因:

 第一,方法重载问题

第二,字符超过了长度

第三,就是编码问题(重要,容易被人忽略)

         有两种可能,第一种就是数据库编码,另外一种数据库编码没问题,文件编码有问题

相关文章:

  • 2021-10-17
  • 2021-07-19
  • 2022-12-23
  • 2022-02-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
猜你喜欢
  • 2021-05-31
  • 2021-08-13
  • 2021-06-03
  • 2021-09-11
  • 2022-12-23
  • 2022-12-23
  • 2021-04-23
相关资源
相似解决方案