apache/seatunnel

[Bug] [Mysql source] There is Chinese character garbling

Open

#9603 opened on Jul 22, 2025

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Java (6,897 stars) (1,432 forks)batch import
bughelp wanted

Description

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

Hello, I'm also encountering this issue. Here is my job configuration. Could you take a look? The fields in the automatically created tables are garbled.

SeaTunnel Version

2.3.10

SeaTunnel Config

env {
  parallelism = 1
  job.mode = "STREAMING"
  checkpoint.interval = 10000
}

source {
  MySQL-CDC {
    base-url = "jdbc:mysql://172.16.21.169:3307/czhl_new_column?characterEncoding=UTF-8"
    username = "root"
    password = "123"
    database-names = ["czhl_new_column"]
    table-names = ["czhl_new_column.def_user"]
    startup.mode = "initial"
    plugin_output = "source1"
  }

  
}

transform {
  Sql {
    query = "SELECT id as `user_id`, username as `user_username拉阿拉`, nick_name as `user_nick_name`, mobile as `user_mobile` FROM dual"
    plugin_input = "source1"
    plugin_output = "transform1"
  }
}

sink {
  jdbc {
    plugin_input = "transform1"
    url = "jdbc:mysql://172.16.21.169:3307/seatunnel_sync_test?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true"
    driver = "com.mysql.cj.jdbc.Driver"
    user = "root"
    password = "123"
    
    generate_sink_sql = true
    database = "seatunnel_sync_test"
    table = "user_employee"
    primary_keys = ["user_id"]
    schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"
    data_save_mode = "APPEND_DATA"
  }
}

Running Command

null

Error Exception

null

Zeta or Flink or Spark Version

No response

Java or Scala Version

No response

Screenshots

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Contributor guide