Mysql Incorrect integer value(1366)错误解决方法
来源:互联网 发布:软件项目报价明细表 编辑:程序博客网 时间:2024/04/29 14:58
java.sql.SQLException: Incorrect integer value: '' for column 'id' at row 1 收藏
insert into log values('','admin','31','physics')
这样写就会报错:
Incorrect integer value: '' for column 'id' at row 1
这种应该是版本问题,尤其是虚拟主机。
把''改成null不会出错:
insert into log values(null,'admin','31','physics')
insert into log values(' ','admin','31','physics')//加个空格
这种问题一般mysql 5.x上出现。我用的mysql5.1,后面查询得知新版本mysql对空值插入有"bug",要在安装mysql的时候去除默认勾选的enable strict SQL mode。如果已经安装好了的,就在my.ini中查找sql-mode,默认为sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION",将其修改为sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION",重启mysql后即可。
发现以前的程序居然不能正常运行,提示信息如下:
Database error: Invalid SQL: INSERT INTO Survey_UserHistory(userId,jobId,type,action,startTime,endTime) VALUES(’17′,”,’User’,’Login’,”,’2008-11-23 14:33:56′)
MySQL error: 1366 (Incorrect integer value: ” for column ‘jobId’ at row 1)
Session halted.
第一时间的反应是跟mysql5.0新加的sql-mode有关系,因为前一阵子刚刚看过手册.果然,作了如下更改后就不再提示了.
修改 my.ini 文件.
# Set the SQL mode to strict
sql-mode=”STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
改为:
# Set the SQL mode to strict
sql-mode=”NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION”
- Mysql Incorrect integer value(1366)错误解决方法
- Incorrect integer value(1366)错误解决方法
- MySQL 错误 1366:1366 Incorrect integer value
- mysql 1366 Incorrect integer value错误
- MySQL 错误 1366:1366 Incorrect integer valueMySQL 错误 1366:1366 Incorrect integer value
- MySQL报错“1366 - Incorrect integer value
- 1366 Incorrect integer value
- MySQL 报错 Truncated incorrect INTEGER value: ''
- MYSQL报错:Incorrect integer value
- MySQL出现Incorrect integer value: '' for column 'id' at row 1解决方法
- MySQL的ERROR 1366 (HY000): Incorrect string value错误解决
- 消除#1366 - Incorrect integer value: '' for column
- Incorrect integer value
- MYSQL 中 Incorrect string value: 错误
- Mysql插入中文错误 Incorrect string value
- 关于MySQL插入数据里有中文字符出现Incorrect string value的错误的解决方法
- Navicat中 1366错误 incorrect string value
- MySql中文乱码错误 mysql error 1366 incorrect string value 不能插入中文字符
- 为DM6446交叉编译libjpeg v8b
- 外部合并法
- oracle10g(10.2.0.1.0)从安装到数据泵导入数据全过程流程
- python - 自省
- js Form
- Mysql Incorrect integer value(1366)错误解决方法
- hibernate关联映射
- 数据结构之线性表顺序存储的常用操作(转载)
- SQL Server中的TextPtr函数
- SQL中 在字符串中查找所有中文字符
- 解决ASP.NET中文乱码
- 关于“由于应用程序配置不正确,程序未能启动..."的错误
- 好看适用的日历控件
- IT项目的面向对象分析设计、开发及管理