I've received a server error running a Data transfer component from Sql Server to MySql db. The error message reads as follows:
[MySql][ODBC 5.1 Driver][mysqld-5.0.67-community-nt-log]Server does not support 4-byte encoded UTF8 characters.
The source Sql Server table contains nvarchar columns, the target MySql table contains varchar columns.
Can anybody shed some light on this problem?
I had the same problem which I could reproduce by simply updating a
char(1)
column for a single row over a linked server on SQL 2008 to a MySQL 5.1 DB:This error was occurring on a newly built server. I had a similar setup on another machine, where the same code worked just fine. The only difference was the version of the MySQL ODBC driver: on the new server, it was 5.2.2; on the old (working) server, it's 5.1.8 (now unsupported).
I downloaded and installed the previous version of the ODBC driver (v5.1.11), and the problem went away.
"4-byte encoded UTF-8 characters" refers to characters with code point
> 0xFFFF
, i.e., ones whose code points don't fit within 16 bits (are outside the basic multilingual plane (BMP)). Many older systems don't support characters outside the BMP.Characters outside the BMP are usually CJK characters; I don't know if that's the case with you here. :-)
If you need MySQL to support 4-byte UTF-8 characters (which is normally considered part of UTF-8), you need to use the character set utf8mb4, not utf8. utf8mb4 was first supported in MySQL 5.5.3.
From the documentation:
I was getting this error message with 1 client machine making an ODBC connection to pull data into an excel spreadsheet. Several other machines could update this same spreadsheet with no trouble.
After a bit of searching, I found nothing, so started experimenting. The ODBC connection was setup with the MySQL unicode driver. I recreated the connection using the ANSI driver and it works fine.
Hope this helps someone else.
Update your MySQL to 5.5.3 and use utf8mb4 for column encoding.
Force copy
Create a new table in SQLServer with the same structure as the table you need to copy
Change the new table's column nvarchar(size) -> varchar(size x 2)
Copy the data into the new table
Copy the SQLServer's data from the new table to MySQL