When I try to execute a query via flyway from my java application, the data in my database are saved in incorrect form. Example is the query below:
INSERT INTO `table_lang` (`id`, `name`) VALUES ('14', 'русский');
The name in table_lang after execution for id= 14 is
p??????
So I thought that the problem was due to the input file, and I tried to insert in the query my name converted with various charsets
and I tried to change the charset and the collate of my table of interest respectively
CHARACTER SET = utf16 , COLLATE = utf16_general_ci ;
CHARACTER SET = utf8 , COLLATE = utf8_general_ci ;
CHARACTER SET = utf16 , COLLATE = utf16_general_ci ;
CHARACTER SET = utf8mb4 , COLLATE = utf8mb4_general_ci ;
None of these approaches work. Do you know how it can be solved?
Use CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
You may also need to add characterEncoding=UTF-8 in your JDBC connection string.
With these settings I'm able to write and retrieve Russian and also Turkish charachers on my system.
You may also be interested in How to support full Unicode in MySQL databases
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With