java.sql.SQLException: Incorrect string value: '\xE6\x88\x91\xE7\x9A\x84...' for column ...
2017-03-24 13:04
525 查看
重装mysql后,用Java程序往mysql中写数据,出现如下错误:
java.sql.SQLException: Incorrect string value: '\xE6\x88\x91\xE7\x9A\x84...' for column 'title' at row 1
解决方案:
原程序中向数据库中创建表的操作,语句如下:
"create table 表名 (字段名...) ;"
创建每张表的时候都必须设置数据编码方式,改后的语句如下:
"create table 表名 (字段名...) charset utf8 collate utf8_general_ci;"
总结一下,引起本文章标题这样的问题的原因有以下几个:
(1).创建数据库的时候数据编码设置错误
(2).连接数据库的时候数据编码设置错误
(3).创建表的时候数据编码设置错误
java.sql.SQLException: Incorrect string value: '\xE6\x88\x91\xE7\x9A\x84...' for column 'title' at row 1
解决方案:
原程序中向数据库中创建表的操作,语句如下:
"create table 表名 (字段名...) ;"
创建每张表的时候都必须设置数据编码方式,改后的语句如下:
"create table 表名 (字段名...) charset utf8 collate utf8_general_ci;"
总结一下,引起本文章标题这样的问题的原因有以下几个:
(1).创建数据库的时候数据编码设置错误
(2).连接数据库的时候数据编码设置错误
(3).创建表的时候数据编码设置错误
相关文章推荐
- java.sql.SQLException: Incorrect string value: '\xE6\x88\x91\xE7\x9A\x84...' for column body
- java.sql.SQLException: Incorrect string value: '\xE6\x88\x91\xE7\x9A\x84...' for column 'groupName'
- MySQL错误——java.sql.SQLException: Incorrect decimal value: \'\' for column \'sys_offset_seq\' a
- Caused by: java.sql.SQLException: Incorrect integer value: '' for column 'clientId' at row 41
- java.sql.BatchUpdateException: Incorrect string value: '\xD6\xD0\xB9\xFA\xB9\xA4...' for column 'con
- java.sql.SQLException: Incorrect integer value: '' for column 'id' at row 1
- java.sql.SQLException: Incorrect string value: '\xE9\x99\xB6\xE4\xBC\x9F...' for column 'name' at ro
- java.sql.SQLException: Incorrect string value: '\xE5\x90\x88\xE8\xAE\xA1' for column
- java.sql.SQLException: Incorrect string value: 插入中文报错
- Exception in thread "main" java.sql.SQLException: Incorrect string value: '\xF0\xA2\x9C\xB6\xE2\x80.
- java.sql.SQLException: ORA-01461: can bind a LONG value only for insert into a LONG column
- 【异常处理】Incorrect string value: '\xF0\x90\x8D\x83...' for column... Emoji表情字符过滤的Java实现
- mysql 错误 SQL Error: 1366: Incorrect string value: "\xE8\xAF\xA6\xE7\xBB\x86…" for column "address" a
- [乐意黎原创] java.sql.SQLException: Incorrect string value: '\xC3\x8E\xC2\xA2\xC3\x88...'
- MySql系列:中文写入数据库出现错误java.sql.SQLException: Incorrect string value: '\xE5\xxxx' for column 'xxxx' at row 1及其解决方法
- 解决java插入mysql时出现java.sql.SQLException: Incorrect string value: '\xF0...'问题
- 关于mysql的java.sql.SQLException: Incorrect string value: '\xF0\x9F\x91\xBD\xF0\x9F…'问题
- mysql 错误 SQL Error: 1366: Incorrect string value: "\xE8\xAF\xA6\xE7\xBB\x86…" for column "address" a
- mysql: java.sql.SQLException: Incorrect string value: '\xF0\x9F\x92\x90</...'
- JBPM java.sql.BatchUpdateException: Data truncation: Incorrect datetime value: '' for column 'START_