Language Scala
SQL Package Slick 3.2.0
MySQL Database
Database Synchronization Program Error
string ' \xf0\x9f\x87\xb5\xf0\x9f ... ' for ' content ' 1
This error is too much to see, emoji characters and utf-8 incompatible, utf8mp4 character set support emoji
Source Library (provided by another company) changed the character set of the table, did not notify us, from the library and the source library character set, synchronization with partial character error
Change MySQL, change the synchronization program character set can
Simple to change MySQL
ALTER Table Table CONVERT to CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Synchronization services are implemented in Scala and referenced by slick
Slick compared to utf8mb4 the whole network is not much information, but the idea and the traditional Java project consistent
If the official configuration has no relevant parameters, there are INI solutions, so there are two ways
The original connection mode is
Val dest_db = Database.forurl ("jdbc:mysql://127.0.0.1:3306/table?characterencoding=utf-8&charset =UTF8MB4""root"" 123456 "" Com.mysql.jdbc.Driver")
Two ways to solve the problem
1 manual run Execution INI statement
Val dest_db = Database.forurl ("jdbc:mysql://127.0.0.1:3306/table?characterencoding=utf-8&charset =UTF8MB4""root"" 123456 "" Com.mysql.jdbc.Driver") origin_db.run (SQL"""SET NAMES utf8mb4 COLLATE Utf8mb4_unicode_ci"" ". As[int])
2 starting with the JDBC INI
Val origin_db = Database.forurl ("jdbc:mysql://127.0.0.1:3306/table?charset=utf8mb4;init=\ "SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci\"", user ="Root", password ="123456", Driver ="Com.mysql.jdbc.Driver", executor = Asyncexecutor ("orgindb", minthreads=1, queuesize=Ten, maxthreads=Ten, maxconnections=Ten), keepaliveconnection=true)
Scala Slick MySQL utf8mb4 support