NutzCN Logo
问答 insert后数据库乱码问题
发布于 1402天前 作者 苍蓝猛兽 942 次浏览 复制 上一个帖子 下一个帖子
标签:

日志

2017-12-19 21:50:17.957 DEBUG 9468 --- [nio-8081-exec-9] o.nutz.dao.impl.sql.run.NutDaoExecutor   : INSERT INTO t_business_order(id,bdate,user,spoint,epoint) VALUES(?,?,?,?,?) 
    |              1 |          2 |     3 |    4 |    5 |
    |----------------|------------|-------|------|------|
    | 17121921491001 | 2017-12-19 | admin | 测试起点 | 测试终点 |
  For example:> "INSERT INTO t_business_order(id,bdate,user,spoint,epoint) VALUES(17121921491001,'2017-12-19','admin','测试起点','测试终点') "

数据库

字符集 utf-8

插入数据是 问号 ????

spoint,epoint的字段都是varchar(255)

nutz插入代码

dao.insert(order, true, false, true);

为什么????

5 回复

程序本身的字符集也是utf8吗?该数据表的字符集也是utf8吗?

NutDao启动是时候,会打印mysql的编码信息,贴来看看(如果是mysql的话)

@wendal

启动日志

2017-12-19 21:59:50.550 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_client=latin1
2017-12-19 21:59:50.550 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_connection=latin1
2017-12-19 21:59:50.551 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_database=utf8
2017-12-19 21:59:50.551 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_filesystem=binary
2017-12-19 21:59:50.551 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_results=
2017-12-19 21:59:50.551 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_server=latin1
2017-12-19 21:59:50.551 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_set_system=utf8
2017-12-19 21:59:50.551 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : character_sets_dir=/usr/local/mysql-5.6.37/share/charsets/
2017-12-19 21:59:50.581 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : binlog_format=STATEMENT
2017-12-19 21:59:50.637 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : database=pdm
2017-12-19 21:59:50.668 DEBUG 11224 --- [  restartedMain] o.n.dao.impl.jdbc.mysql.MysqlJdbcExpert  : Mysql : user=root@xx

程序一直是utf-8

character_set_connection=latin1

@wendal 已解决 大兽总 6666666666

添加回复
请先登陆
回到顶部