com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'user_name' at row 1
错误,具体信息如下:
严重: Servlet.service() for servlet default threw exceptio
com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column 'user_name' 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:1160)
at com.mysql.jdbc.ServerPreparedStatement.executeInternal(ServerPreparedStatement.java:685)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1400)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1314)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1299)
at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:745)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:538)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:739)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:797)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:805)
at com.bester.blog.dao.impl.UserDAOImpl.add(UserDAOImpl.java:25)
at com.bester.blog.service.impl.UserServiceImpl.add(UserServiceImpl.java:12)
at com.bester.blog.web.action.UserAction.add(UserAction.java:30)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
........................
看着这错误信息,怎么有似曾相识的感觉呢。但就是记不起来了。根据字面意思,一位是输入超出范围了。但我的user_name字段设置的是varchar(45),只输入了三个中文,怎么可能超出呢?
google一下,一看到字符设置字眼,忽然想起以前碰到过这个问题的。只是早以到了九霄云外罢了。
原因在于:建表的时候,表的编码和字段编码都是默认的latin1,设置为utf8后,问题解决。
相关推荐
- `com.mysql.jdbc.MysqlDataTruncation: Data truncation: Data too long for column` 错误表示数据长度超过了列的允许长度,这通常不是字符集问题,而是字段长度不足。需检查对应列的定义并调整其大小。 7. **...
**问题1:** 当插入数据时出现“Data truncation: Data too long for column”错误。 **解决方法:** - 检查字段长度是否足够。 - 考虑增加字段的长度或者调整数据以适应现有的字段长度。 **问题2:** 应用程序抛...
发现问题 图片地址如下 ...需要实现的效果是要加上尺寸,如以下效果 ...一开始想当然使用 UPDATE tag_group SET cover = cover + '|...Data truncation: Truncated incorrect DOUBLE value: ‘http://huoche.7234.cn/im
ERROR SqlExceptionHelper:147 Incorrect string value: '\xE6\xB2\xA1\xE5\x90\x83' for column 'others' at row 1 org.springframework.orm.jpa.JpaSystemException: could not execute statement; nested ...
Data Truncation(亲测可用).md
字符串::截断 使用全角字符和ANSI代码截断字符串。 特征 没有猴子修补String类 ... strings = Strings :: Truncation . new strings . truncate ( "I try all things, I achieve what I can." ) # => "I try all thing
在MATLAB编程环境中,`truncation`是一个常见的数学操作,用于处理浮点数,将它们转换为整数或者按照指定精度进行截断。在给定的标题和描述中,我们关注的是一个特定的MATLAB函数,即`truncate`,它用于截断一个给定...
在IT领域,尤其是在Web开发中,SVG(Scalable Vector Graphics)是一种常用的技术,用于创建矢量图形。本文将深入探讨“截断”这一概念,特别是在多边形处理中的应用,以及如何使用React来实现SVG图标的构建。...
NGX线截断Ngx Line Truncation是Angular的行截断实现,可通过用户定义的行号截断文本。 () 除行截断外,此软件包还进行了一些性能优化,不仅提高了可用性,而且还提高了Angular平台的可靠性。 它使用重试逻辑来...
本书《Survival Analysis: Techniques for Censored and Truncated Data》由John P. Klein和Melvin L. Moeschberger合著,第二版进一步扩展和完善了第一版的内容。 #### 二、删失与截尾的概念 **删失(Censoring)**...
3. 数据类型不匹配:当尝试将不兼容的数据类型插入到数据库中时,如`Data truncated for column 'gatheringMoney' at row 1`和`Data truncation: Out of range value adjusted for column 'amount' at row 14`,表明...
昨晚在往MySQL数据库中插入一组数据时,出错了!数据库无情了给我报了个错误:ERROR 1365(22012):Division by 0;意思是说:你不可以往数据库中插入一个 除数为0的运算的结果。于是乎去谷歌了一番,总算是明白了...
图像编码,this paper presents a modified block truncation coding(BTC) algorithm for image compression.Similar block in an image are mergrd intoa cluster and represented with the cluster center.
3. **导入到Oracle**:Oracle提供了多种导入工具,如SQL*Loader、Data Pump(expdp/impdp)和SQL Developer。SQL*Loader适合处理大量数据,Data Pump则用于大规模的数据迁移。SQL Developer是一款图形界面工具,适合...
This book presents a systematic and unified approach for modern nonparametric treatment of missing and modified data via examples of density and hazard rate estimation, nonparametric regression, ...
Because most digital images are stored and transmitted in compressed forms, such as JPEG, vector quantization, and block truncation coding (BTC), the reversible data hiding schemes in compressed ...
This section covers the precision differences between `float` and `double`, as well as best practices for handling floating-point numbers, such as rounding and truncation. #### 1.5 The Pointer ...
Title: Applied Numerical Methods with MATLAB for Engineers and Scientists, 4th Edition Author: Steven Chapra Length: 720 pages Edition: 4 Language: English Publisher: McGraw-Hill Education Publication...
The document highlights the importance of understanding type promotion and truncation, which occur when performing operations between different data types. For instance, an operation involving an `...