开发者

ODBC vs MySQLClient

开发者 https://www.devze.com 2022-12-29 10:48 出处:网络
I\'m currently using ODBC to connect to my MySQL database, using C#. I\'ve been told that using the MySql Connector would be better, and faster, and not dependent on Windows.Can someone shed some ligh

I'm currently using ODBC to connect to my MySQL database, using C#. I've been told that using the MySql Connector would be better, and faster, and not dependent on Windows. Can someone shed some light开发者_如何学编程 on this please? I've been unable to find anything on the net so far


I'm not sure what you are asking for tbh. But ODBC is a generic provider while the mysql provider is specific for mysql db. Therefore the specific provider could be more optimized towards mysql and preform better. Both ODBC and the mysql provider is available for mono (linux, unix) and .net (windows) but it's always recommended to use the specific provider if there is one.


Write a test application (well, two applications, I suppose - one for ODBC and one for MySql Connector) and measure the performance difference. Make sure you flush caches/burn incense/sacrifice to the god or gods of your choice/etc (don't know if this is possible/necessary on MySql) between runs. In the past I've done this (minus the incense and sacrifices, so results may have been inadvertently skewed) with other database access tools and found that ODBC added runtime overhead ranging from 5% on simple, quick queries to effectively no overhead on complex, long-running queries. YMMV.

Share and enjoy.

0

精彩评论

暂无评论...
验证码 换一张
取 消