seatunnel
seatunnel copied to clipboard
[Bug] [FakeSource Connector]java.sql.BatchUpdateException: Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'name' at row 1
Search before asking
- [X] I had searched in the issues and found no similar issues.
What happened
when I use jdbc sink, an error has occurred.
String sql = "CREATE TABLE test (\n" +
" name VARCHAR(255) NOT NULL,\n" +
" age INT NOT NULL\n" +
")";
source { FakeSource { result_table_name = "my_dataset" } }
transform { sql { sql = "select name,age from my_dataset" result_table_name = "fake" } }
sink { Jdbc { source_table_name = fake driver = com.mysql.cj.jdbc.Driver url = "jdbc:mysql://jdbc:3306/test" user = test password = test query = "insert into test(name,age) values(?,?)" batch_size = 2 }
SeaTunnel Version
dev
SeaTunnel Config
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
######
###### This config file is a demonstration of streaming processing in seatunnel config
######
env {
# You can set flink configuration here
execution.parallelism = 1
job.mode = "BATCH"
#execution.checkpoint.interval = 10000
#execution.checkpoint.data-uri = "hdfs://localhost:9000/checkpoint"
}
source {
# This is a example source plugin **only for test and demonstrate the feature source plugin**
FakeSource {
result_table_name = "my_dataset"
}
# If you would like to get more information about how to configure seatunnel and see full list of source plugins,
# please go to https://seatunnel.apache.org/docs/flink/configuration/source-plugins/Fake
}
transform {
sql {
sql = "select name,age from my_dataset"
result_table_name = "fake"
}
# If you would like to get more information about how to configure seatunnel and see full list of transform plugins,
# please go to https://seatunnel.apache.org/docs/flink/configuration/transform-plugins/Sql
}
sink {
Jdbc {
source_table_name = fake
driver = com.mysql.cj.jdbc.Driver
url = "jdbc:mysql://jdbc:3306/test"
user = test
password = test
query = "insert into test(name,age) values(?,?)"
batch_size = 2
}
# If you would like to get more information about how to configure seatunnel and see full list of sink plugins,
# please go to https://seatunnel.apache.org/docs/flink/configuration/sink-plugins/Console
}
Running Command
jdbc e2e command
Error Exception
Incorrect string value: '\xAC\xED\x00\x05sr...' for column 'name' at row
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
- [X] I agree to follow this project's Code of Conduct
you can add CHARSET = 'utf8mb4'
when creating mysql table.
you can add
CHARSET = 'utf8mb4'
when creating mysql table.
It still doesn't work. String sql = "CREATE TABLE test (\n" + " name varchar(255) NOT NULL,\n" + " age int NOT NULL\n" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8mb4";
you can add CHARSET = 'utf8mb4' when creating mysql database.
This issue has been automatically marked as stale because it has not had recent activity for 30 days. It will be closed in next 7 days if no further activity occurs.