社区
其他技术讨论专区
帖子详情
java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...' for colum
weixin_38048698
2016-07-18 04:54:03
开发四年只会写业务代码,分布式高并发都不会还做程序员?->>>
@JFinal 你好,想跟你请教个问题: Record 插入数据库表中,如果其中的一个字段是varchar,Java的对象时StringBuilder, 插入时会抛出java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...' for colum '字段名' at row 1 将StringBuilder转换为String 就好了
...全文
1549
2
打赏
收藏
java.sql.SQLException: Incorrect string value: '\xAC\xED\x00\x05sr...' for colum
开发四年只会写业务代码,分布式高并发都不会还做程序员?->>> @JFinal 你好,想跟你请教个问题: Record 插入数据库表中,如果其中的一个字段是varchar,Java的对象时StringBuilder, 插入时会抛出java.sql.SQLException:Incorrectstringvalue:'\xAC\xED\x00\x05sr...'forcolum '字段名' atrow1 将StringBuilder转换为String 就好了
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
My
SQL
存储表情时报错:
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
:‘\xF0\x9F\x92\xA9\x0D\x0A…’的解决方法
前言 本文主要介绍了关于My
SQL
存储表情报错:
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
: ‘\xF0\x9F\x92\xA9\x0D\x0A…’的相关解决方法,分享出供大家参考学习,下面话不多说了,来一起看看详细的介绍: 本项目是基于Spring MVC + My
SQL
+ Druid DataSource。在往数据库插入表情Emoji字符时报错:
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
: ‘\xF0\x9F\x92\xA9\x0D\x0A…’ 普通字符最多占用3个字节,使用utf8足够
「Jenkins Pipeline」-
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
: ‘\
xAC
\
xED
\
x00
\
x05sr
...‘ for
colum
问题描述 在 Jenkins Pipeline 中,我们使用 PreparedStatement 执行
SQL
语句,产生如下错误:
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
: '\
xAC
\
xED
\
x00
\
x05sr
...' for
colum
n 'content' at row 1 问题原因 传入 PreparedStatement 的
Sql
参数并不是
String
类型 使用以下代码可以验证,我们传入 的并不是
String
类型.
解决my
sql
修改报错:
Incor
rect
string
value
: '\
xAC
\
xED
\
x00
\
x05sr
...' for
colum
n 'enabled' at row 1
报错:
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
: '\
xAC
\
xED
\
x00
\
x05sr
...' for
colum
n 'enabled' at row 1我调用 下面update方法,
SQL
报错,提示
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
: '\
xAC
\
xED
\
x00
\
x05sr
...' for...
彻底解决:
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
:
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
: '\xF0\x9F\x92\x94' for
colum
n 'name' at row 1 出现原因:当insert数据中有表情时发生。而这些表情是按照4个字节一个单位进行编码的,而我们使用的utf-8编码在my
sql
数据库中默认是按照3个字节一个单位进行编码的. 第一步:修改my
sql
的配置文件my
sql
/bin/my.ini, 添加如下内容: 注意:是添加内容 [client] default-c..
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
解决办法
由于数据库编码格式不能存储四个字节的文字(表情等) ,一般使用utf8,但是utf8存储的一个字符是3个字节,如果存储的一个字符为4个字节就会报
java
.
sql
.
SQL
Exception
:
Incor
rect
string
value
两种解决办法: 1. 更改数据库字段编码 ALTER TABLE `数据库名`.表名 MODIFY `字段名` VARCHAR(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; 2. 更改插入内容 将插入内容转化为
其他技术讨论专区
473
社区成员
791,201
社区内容
发帖
与我相关
我的任务
其他技术讨论专区
其他技术讨论专区
复制链接
扫一扫
分享
社区描述
其他技术讨论专区
其他
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章