Data truncation: Out of range value

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

遇到一个奇怪的错误

com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value for column 'userId' at row 1
	com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3374)
	com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
	com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
	com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
	com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
	com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
	com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2022)
	com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1940)
	com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1925)
	org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
	org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)

 

然后追溯到sql语句

Sql代码   收藏代码
  1. insert   
  2.         into  
  3.             t_access_log  
  4.             (access_day, access_daytime, access_type, description, device_id, device_type, extranet_ip,   
  5. ip, operate_result, os_type, query_string, request_target, requestURI, reserved, session2_id, time, user_agent, userId, username)   
  6.         values  
  7.             ('2016-03-18''2016-03-18 20:23:03''1''手机端视频列表'nullnull'127.0.0.1''127.0.0.1',  
  8.  '总条数:756'nullnull'video:json''/video/json'NULL'E065035A48A191F7DA5BA312E0112705', 1458303783,   
  9. 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36', -1, null);  

 执行结果:

[SQL]insert 

        into

            t_access_log

            (access_day, access_daytime, access_type, description, device_id, device_type, extranet_ip, 

ip, operate_result, os_type, query_string, request_target, requestURI, reserved, session2_id, time, user_agent, userId, username) 

        values

            ('2016-03-18', '2016-03-18 20:23:03', '1', '手机端视频列表', null, null, '127.0.0.1', '127.0.0.1',

 '总条数:756', null, null, 'video:json', '/video/json', NULL, 'E065035A48A191F7DA5BA312E0112705', 1458303783, 

'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36', -1, null);

[Err] 1264 - Out of range value for column 'userId' at row 1

 

看看userId的类型,终于找到了原因

 

userId的类型是正整数,所以报错了

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
RuntimeError: Given groups=1, weight of size 64 128 1 7, expected input[16,
RuntimeError: Given groups=1, weight of size 64 128 1 7, expected input[16,
2343 0
|
11月前
Expected more than 1 value per channel when training, got input size torch.Size
因为模型中用了batchnomolization,训练中用batch训练的时候当前batch恰好只含一个sample,而由于BatchNorm操作需要多于一个数据计算平均值,因此造成该错误。
694 0
|
JSON 数据格式
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
425 0
ValueError: With n_samples=0, test_size=0.15 and train_size=None, the resulting train set will be em
|
存储
range_hashed
range_hashed
66 0
range
range() 是一个函数,可以用来生成一个自然数的序列。 该函数需要三个参数:起始位置(可以省略,默认是 0);结束位置;步长(可以省略,默认是 1)。 通过 range() 可以创建一个执行指定次数的 for 循环。
76 0
range
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
成功解决ValueError: With n_samples=0, test_size=0.3 and train_size=None, the resulting train set will be
|
索引 Python
成功解决ValueError: column index (256) not an int in range(256)
成功解决ValueError: column index (256) not an int in range(256)
成功解决ValueError: column index (256) not an int in range(256)
|
存储 索引
成功解决ValueError: If using all scalar values, you must pass an index
成功解决ValueError: If using all scalar values, you must pass an index
|
数据库
Data truncation: Out of range value for column ‘estimate_score‘
Data truncation: Out of range value for column ‘estimate_score‘
ValueError: Error when checking : expected input_1 to have 4 dimensions, but got array with shape
ValueError: Error when checking : expected input_1 to have 4 dimensions, but got array with shape
359 0