mysql对odbc的支持_在MySQL中对utf8mb4的ODBC连接器支持

bd96500e110b49cbb3cd949968f18be7.png

I have been stuck up in this scenario.

My application is in C++ which connects to MySQL database 5.5.34 through MySQL odbc connector v5.2 Unicode Driver.

My tables were using the character set and collation properties 'utf-8'. To insert supplementary unicode characters, i changed it via

My table was initially created:

CREATE TABLE mytable (SAMPLECOLUMN text) ENGINE=InnoDB DEFAULTCHARSET=utf8;

changed to,

ALTER TABLE mytable CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

After this, I am able to directly (not through my app) insert the supplementary characters into the column holding 'TEXT' data type.

The odbc connector crashes when it encounters supplementary characters.

The following are some of my my.ini configurations.

[mysql]

default-character-set=utf8

[mysqld]

character-set-server=utf8

default-storage-engine=INNODB

The query that i am trying to insert:

INSERT INTO mytable (SAMPLECOLUMN) VALUES ("乕乭𠁄𠁉乺丕");

any pointers/heads up would be great.

Also, tried using v5.3 Unicode MYSQL odbc connector and v1.0.5 MariaDB ODBC connector, still the same.

Thanks in advance.

解决方案

The workaround here is to use MariaDB odbc connector to connect to MySQL database.

https://mariadb.com/my_portal/download/connector-odbc/1.0

Make sure you set this in ODBC dsn and keep Connection Character Set empty

WoXw8.png

Starting v5.2 of MyODBC, SET NAMES has been deprecated. Hence the need to use MariaDB connector. Hope the supplementary character issue is fixed in MySQL odbc connector.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值