码迷,mamicode.com
首页 > 数据库 > 详细

com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '张三'异常的解决办法

时间:2020-06-10 21:05:53      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:bsp   col   ade   mysql   ber   truncate   translate   date   pre   

com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: ‘张三‘异常的解决办法

错误:

 com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: ‘张三‘
  at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:104)
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:955)
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1094)
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdateInternal(ClientPreparedStatement.java:1042)
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeLargeUpdate(ClientPreparedStatement.java:1345)
  at com.mysql.cj.jdbc.ClientPreparedStatement.executeUpdate(ClientPreparedStatement.java:1027)
    ..........................................

解决方法:查看sql语句,注意更新操作的各个字段之间不能用and连接,而应当是用“  ,”连接

错误示范:

 update student set stu_name=? and stu_sex=? and stu_age=? and stu_tel=? where stu_id=?

正确示范:

 update student set stu_name=?,stu_sex=?, stu_age=? , stu_tel=? where stu_id=?

 

com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: '张三'异常的解决办法

标签:bsp   col   ade   mysql   ber   truncate   translate   date   pre   

原文地址:https://www.cnblogs.com/nieaojie625/p/13088640.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!