Incorrect string value: '\xE7\xBB\xA0\xEF\xBC\x84...' for column 'name_zh' at row 1
记录解决 Incorrect string value: ‘\xE7\xBB\xA0\xEF\xBC\x84…’ for column ‘name_zh’ at row 1 方法
今天在学习Spring Security + Spring Data Jpa 在启动测试类时报错:
我主要是在做Spring Security 通过Spring Data Jpa 通过bean 自动生成用户表、角色表 并向表内插入数据 时出现错误
2020-04-22 17:49:39.605 INFO 15576 --- [ main] ingsecurityspringdatajpaApplicationTests : Started SpringsecurityspringdatajpaApplicationTests in 3.964 seconds (JVM running for 5.003)Hibernate: insert into t_user (account_non_expired, account_non_locked, credentials_non_expired, enabled, password, username) values (?, ?, ?, ?, ?, ?)
Hibernate: insert into t_role (name, name_zh) values (?, ?)
2020-04-22 17:49:39.807 WARN 15576 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1366, SQLState: HY000
2020-04-22 17:49:39.807 ERROR 15576 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Incorrect string value: '\xE7\xBB\xA0\xEF\xBC\x84...' for column 'name_zh' at row 1org.springframework.orm.jpa.JpaSystemException: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statementat org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:353)at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:255)at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:528)at ......
2020-04-22 17:49:39.843 INFO 15576 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2020-04-22 17:49:39.850 INFO 15576 --- [extShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.Process finished with exit code -1
重新检查了代码,发现代码没有问题,然后打开数据库发现,表已经生成,然后查看错误代码,发现了一条:
2020-04-22 17:49:39.807 WARN 15576 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 1366, SQLState: HY000
2020-04-22 17:49:39.807 ERROR 15576 --- [ main] o.h.engine.jdbc.spi.SqlExceptionHelper : Incorrect string value: '\xE7\xBB\xA0\xEF\xBC\x84...' for column 'name_zh' at row 1
org.springframework.orm.jpa.JpaSystemException: could not execute statement; nested exception is org.hibernate.exception.GenericJDBCException: could not execute statement
那就确定是在添加数据时出现错误,查看了一下生成表的表结构,发现表和库的字符集有问题:
修改库的字符集,并将生成的表删除:
然后重新执行方法,成功了
我解决这个问题其实并没有上面写的这么顺利,各种办法都试了个遍,最终才知道是字符集的问题
Incorrect string value: '\xE7\xBB\xA0\xEF\xBC\x84...' for column 'name_zh' at row 1相关推荐
- Incorrect string value: '/xE7/xA8/x8B/xE5/xBA/x8F...' for column 'course' at row 1
Incorrect string value: '/xE7/xA8/x8B/xE5/xBA/x8F...' for column 'course' at row 1 出现这个错误的原因是,数据库的编码 ...
- Mysql 插入中文错误:Incorrect string value: '\xE7\xA8\x8B\xE5\xBA\x8F...' for column 'course' at row 1
Incorrect string value: '\xE7\xA8\x8B\xE5\xBA\x8F...' for column 'course' at row 1 出现这个错误的原因是,数据库的编码 ...
- 解决mysql插入中文出现错误Incorrect string value: ‘\xE7\xA8\x8B\xE5\xBA\x8F...‘ for column ‘course‘ at row 1
一:使用show create table 加上你自己的表明查看数据表的编码是什么,如果是下图所示则需要修改玮utf-8的编码格式. # 修改表的字符集 alter table test_user d ...
- 解决mysql插入中文出现错误Incorrect string value: '\xE7\xA8\x8B\xE5\xBA\x8F...' for column 'course' at row 1
一:在windows中打开命令行,切换到mysql的bin目录下,登陆数据库,然后把数据库切换到自己的数据库中 二:使用show create table 加上你自己的表明查看数据表的编码是什么,如果 ...
- Mysql 报错:Incorrect string value: ‘\xE4\xBB\x98\xE6\xAC\xBE...‘ for column ‘product_pay_remark‘
1.问题: ### Error updating database. Cause: java.sql.SQLException: Incorrect string value: '\xE4\xBB\x ...
- 出错信息:Incorrect string value: '\xE4\xBD\xA0\xE5\xA5\xBD' for column 'username'
出错信息: java.sql.SQLException: Incorrect string value: '\xE4\xBD\xA0\xE5\xA5\xBD' for column 'username ...
- 关于django在database或者后台输入字段为Incorrect string value: ‘\xE4\xBD\xA0\xE4\xBC\x9A问题
关于django在database或者后台输入字段为Incorrect string value: '\xE4\xBD\xA0\xE4\xBC\x9A问题 MySQL数据库编码的问题,查了很多, 因为 ...
- mysql保存中文异常Incorrect string value: '\xE4\xBD\xA0\xE5\xA5\xBD' for column'
现象: 更新表字段为中文字符时,提示报错Incorrect string value: '\xE4\xBD\xA0\xE5\xA5\xBD' for column 'description' 修改字符 ...
- mysql建表时插入中文_Mysql新建表,插入中文时报错“Incorrect string value: '\xE4\xBD\xA0\xE5\xA5\xBD' for column”问题...
有时候我们在往数据库中输入信息时,如果输入的内容是中文,会报错"Incorrect string value: '\xE4\xBD\xA0\xE5\xA5\xBD' for column&q ...
最新文章
- Pandas_transform的用法
- Android Gradle Plugin 源码解析(上)
- python判断素数的函数_Python素数prime函数练习_Python源码实操
- 数据库的一些基本知识
- Android ListView重写Adapter
- 【技术综述】人脸妆造迁移核心技术总结
- application time for the banking industry
- 进程间通信--无名管道(pipe)
- 【源码】常用的人脸识别数据库以及上篇性别识别源码
- AGC027B Garbage Collector
- 【离散数学】浅析小项与主析取范式和大项与主合取范式
- ht1621b和单片机电平匹配_基于HT1621B段式液晶模块的驱动应用
- MSSQL2008如何关闭代码智能提示?
- 图像的输入\输出和显示
- 蓝桥杯2015年第六届javaB组省赛第一题-三角形面积
- webpack入门1
- MATLAB 输出当前时间
- 破局人工智能:构建AI,与腾讯云一起探索语音应用场景
- 华为U2000网管研究实录 (3) - 运行分析(服务端进程)
- 英语词性的分类及用法详述