• MySQL知识库 :: odbc
  • Should I use Connector/NET or Connector/ODBC to develop my application?

  • Discussion

    Windows application developers often have a choice between using Connector/ODBC and Connector/NET when developing applications. This article will attempt to explain some of the differences between the two applications and their ideal use cases.

    Connector/ODBC

    Connector/ODBC is based on the ODBC standard initially developed by Microsoft. ODBC is an open standard and is well supported on multiple platforms. Most database reporting applications support generic ODBC and often will work with Connector/ODBC (Crystal Reports, for example, supports reporting through Connector/ODBC).

    While Connector/ODBC is widely supported, it achieves this by being very generic. An application makes ODBC calls to an ODBC manager, which passes these calls to an ODBC provider, which in turn converts the calls to the native API of the data source (MySQL). This results in relatively poor performance compared to a more direct, native implementation of the MySQL API.

    Connector/NET

    Connector/NET is a .NET data provider written in managed C#. Connector/NET follows the standard ADO.NET implementation and should feel familiar to most ADO.NET developers. Connector/NET natively implements the MySQL client API, resulting in superior performance compared to Connector/NET in most situations.

    Connector/NET is supported by any language that can utilize ADO.NET providers, including C#, Managed C++, VB.NET, and Delphi. While ADO.NET support is relatively widespread, it does not yet have the level of support that Connector/ODBC enjoys.

    Best Practice

    A general rule of thumb is to use Connector/NET when possible, falling back on Connector/ODBC when an application or development language does not support ADO.NET.