kettle 任务出错Incorrect string value: '\xF0\x9F\x90\xB1Cl...' for column 'xxx'

Kettle 运行任务报错Incorrect string value: '\xF0\x9F\x90\xB1Cl...' for column 'in_shop_name' at row 1

报错信息

Incorrect string value: '\xF0\x9F\x90\xB1Cl...' for column 'in_shop_name' at row 1

解决方案

  • 可能是数据库的编码字符集不对。笔者所遇到的问题就是:
mysql> show variables like 'chara%';
+--------------------------+------------------------------------+
| Variable_name            | Value                              |
+--------------------------+------------------------------------+
| character_set_client     | utf8mb4                            |
| character_set_connection | utf8mb4                            |
| character_set_database   | utf8                               |
| character_set_filesystem | binary                             |
| character_set_results    | utf8mb4                            |
| character_set_server     | utf8mb4                            |
| character_set_system     | utf8                               |
| character_sets_dir       | /data/mysql/my3306/share/charsets/ |
+--------------------------+------------------------------------+
8 rows in set (0.01 sec)

比如这个数据库的character_set_database就是utf8模式,如果你的其他数据库编码设置是utf8mb4时,就可能出现匹配不上的错误。

  • 修改数据库的字符集
mysql> alter database ams_deposit  character set = utf8mb4;
Query OK, 1 row affected (0.02 sec)
  • 再次查看数据库字符集
mysql> show variables like 'chara%';
+--------------------------+------------------------------------+
| Variable_name            | Value                              |
+--------------------------+------------------------------------+
| character_set_client     | utf8mb4                            |
| character_set_connection | utf8mb4                            |
| character_set_database   | utf8mb4                            |
| character_set_filesystem | binary                             |
| character_set_results    | utf8mb4                            |
| character_set_server     | utf8mb4                            |
| character_set_system     | utf8                               |
| character_sets_dir       | /data/mysql/my3306/share/charsets/ |
+--------------------------+------------------------------------+
8 rows in set (0.01 sec)

你可能感兴趣的:(kettle)