liquibase生成数据时乱码,报sql语法错误

  • Choerodon平台版本:0.6.0

  • 运行环境(如localhost或k8s):localhost

  • 遇到问题时的前置条件:

  • 问题描述:

    liquibase生成数据时乱码,报sql语法错误

  • 报错信息(请尽量使用代码块的形式展现):

2018-08-21 18:18:46.661 INFO 16200 — [ main] i.c.liquibase.excel.ExcelSeedDataReader : found table:sys_user ,sheet:sys_user, begin row:7
2018-08-21 18:18:46.692 INFO 16200 — [ main] i.c.liquibase.excel.ExcelDataLoader : ---- begin round 1 ----
2018-08-21 18:18:46.729 INFO 16200 — [ main] io.choerodon.liquibase.excel.DbAdaptor : [sys_user] check exists: <> row:[ADMIN, e10adc3949ba59abbe56e057f20f883e, 18065588777, admin@qq.com,
鍗庢鼎缃湴鏈夐檺鍏徃, 涓彴, 3bed9a6581e7f1a6e5a3ce7d09ceab38, Y, Y, 鍗庢鼎缃湴鏈夐檺鍏徃, APPROVED, 1, 1, 1, 绯荤粺绠$悊鍛榏 ,result :not exists
2018-08-21 18:18:46.764 ERROR 16200 — [ main] io.choerodon.liquibase.excel.DbAdaptor : [sys_user]error insert row:[ADMIN, e10adc3949ba59abbe56e057f20f883e, 18065588777, admin@qq.com, 鍗庢
鼎缃湴鏈夐檺鍏徃, 涓彴, 3bed9a6581e7f1a6e5a3ce7d09ceab38, Y, Y, 鍗庢鼎缃湴鏈夐檺鍏徃, APPROVED, 1, 1, 1, 绯荤粺绠$悊鍛榏 sql:INSERT INTO sys_user(user_name,password,tel_num,email,organizati
on,application,key,is_publish,is_admin,description,state,OBJECT_VERSION_NUMBER,CREATED_BY,LAST_UPDATED_BY,real_name) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
2018-08-21 18:18:46.780 ERROR 16200 — [ main] i.c.liquibase.excel.ExcelDataLoader : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version
for the right syntax to use near ‘key,is_publish,is_admin,description,state,OBJECT_VERSION_NUMBER,CREATED_BY,LAST_’ at line 1

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘key,is_
publish,is_admin,description,state,OBJECT_VERSION_NUMBER,CREATED_BY,LAST_’ at line 1

* 原因分析:
> 应该是由于乱码导致的,打印的日志发现存在两列被识别成一列乱码。
* 疑问:
> 该工具包读取excel乱码?
> excel的模板是从github上取下来的,但是报语法错误。

请问是哪个服务?

是在执行init-local-database.sh,用工具包生成数据的时候,服务是项目上的一个服务

自己的服务请您检查下你的文件格式 。

这乱码不是重点,重点是你数据库字段有个Key,数据库保留字段,插入的时候报语法错误,换个名字。还有建表最好不要用保留字段

好的,多谢,确实是这个问题,之前以为是乱码,因为打印出来的日志两列合并成一列了。

乱码是excel里面的中文,liquibase插入的时候log的乱码,但不影响排错,乱码问题我们记录下,后面解决掉