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)

原因:

第一,方法重载问题

第二,字符超过了长度

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

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

com.mysql.jdbc.MysqlDataTruncation: Data truncation异常的更多相关文章

  1. Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'L

    1.错误叙述性说明 [ERROR:]2015-06-08 09:49:42,523 [异常拦截] org.hibernate.exception.DataException: error execut ...

  2. Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'L

    1.错误描述 [ERROR:]2015-06-08 09:49:42,523 [异常拦截] org.hibernate.exception.DataException: error executing ...

  3. mysql 插入中文报错: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value...

    总结写在前面, 总结: 当Java通过jdbc链接mysql插入中文时,要保证程序可以正常执行,而且插入的中文不会乱码, mysql服务器端,对数据表(不是数据库)的编码设置,要保证是支持中文的,例如 ...

  4. Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'content' a

    1.错误描述 org.hibernate.exception.DataException: could not execute statement at org.hibernate.exception ...

  5. Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as3'

    执行更新时的出错信息 Whitelabel Error Page This application has no explicit mapping for /error, so you are see ...

  6. Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'img' at row 1故障

    Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'img' at ro ...

  7. 数据库报错com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'ua' at row 1

    记一次报错记录,成长路上的点滴 明明使用浏览器或者微信开发工具调试接口没有问题,但是在真机测试时候就出问题了.(((¬_¬)) 500服务器内部错误,要死的节奏啊 登陆tomcat服务器 使用命令ta ...

  8. com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value:...

    在使用mybatis的@Update注解的时候,报了一个这样的错 ### Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncat ...

  9. com.mysql.jdbc.MysqlDataTruncation:Data Truncation:Data too long for column '字段name' at row 1

    1.问题描述: 在mysql插入数据的时候报错:Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long fo ...

随机推荐

  1. xilinx SDK开发 GPIO使用API总结

    t_v GPIO常用函数 1.XGpio_Config *XGpio_LookupConfig(u16 DeviceId) 功能:根据输入设备ID查找该设备. 输入:设备ID. 输出:若找到该设备ID ...

  2. cad.net IExtensionApplication接口的妙用 分开写"启动运行"函数

    cad提供的 IExtensionApplication 接口 是不能实现一次以上的,那么这给编写代码带来了一种不好的情况是,每次都要去修改实现这个接口的类, 如果是一个小的测试功能,你又要去动前面的 ...

  3. Lambda表达式和方法引用

    1 , 为什么用lambda表达式 将重复固定的代码写法简单化 2   ,lambda表达式的实质 对函数式接口的实现(一个接口中只有一个抽象方法的接口被称为函数式接口) package com.mo ...

  4. 第四节:EF Core的并发处理

    1.说明 和EF版本的并发处理方案一致,需要知道乐观并发和悲观并发的区别,EF Core只支持乐观并发:监控并发的两种方案:监测单个字段和监测整条数据,DataAnnotations 和 Fluent ...

  5. Effective.Java第23-33条(泛型相关)

    23.  类结构层次优于标签类 有时你会碰到一个类,它的实例有一个或多个风格,并且包含一个tag属性表示实例的风格.例如,如下面的类表示一个圆或者矩形: public class Figure { / ...

  6. 关于FMX 单击出来右键菜单,并显示在当前下面

    关于FMX  单击出来右键菜单,并显示在当前下面 procedure TForm1.btn6MouseDown(Sender: TObject; Button: TMouseButton; Shift ...

  7. golang 使用 protobuf 的教程

    1.下载protobuf的编译器protoc 地址: https://github.com/google/protobuf/releases window:    下载: protoc-3.3.0-w ...

  8. Prometheus 配置采集目标

    Prometheus 配置采集目标 1.根据配置的任务(job)以http/s周期性的收刮(scrape/pull)2.指定目标(target)上的指标(metric).目标(target)3.可以以 ...

  9. SQL分类之DQL:查询表中的记录

    DQL:查询表中的记录 select * from 表名: 1.语法 select  字段列表from 表名列表where  条件列表group by 分组字段having 分组之后的条件order ...

  10. (Manjaro)VirtualBox异常修复:RTR3InitEx failed with rc=-1912 (rc=-1912)

    引言 VirtualBox运行异常好几天,其中尝试一些操作都没有解决. 版本说明 系统版本:4.19.88-1-MANJARO Vbox镜像:kali-linux-2019.4-vbox-amd64. ...