which driver has the best performance for SQL server within a C++ application? Performance is the most important thing.

2023-07-12T19:46:29.1066667+00:00

Most interested in achieving the best performance in a C++ application.

Current recommendations from Microsoft appears to be:

  1. Microsoft OLE DB Driver for SQL Server
  2. ODBC driver

Which has the best performance?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,328 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 115.7K Reputation points MVP
    2023-07-12T20:37:13.0866667+00:00

    There is little reason why you would not use ODBC. The reason for this is not performance, but the easiness of the interface. ODBC is certainly a lot more cumbersome than using SqlClient in .NET, but compared to OLE DB it is a breeze. Using OLE DB leads to very verbose code. There used to be the Consumer Templates which can simplify these, but I don't how current these are.

    Disclaimer: I've never programmed against ODBC, but I've used OLE DB for an API. It was kind of fun, and since it is an API. all queries go through the same code, but repeating that for every query, no thank you.

    When it comes to performance, I have no current information, but way back in 2005 I attended a session at PASS, where the Program Manager for SQL Native Client, which was a new thing with SQL 2005, said that they had been able to do some tuning in ODBC, but not in OLE DB. He also recommended ODBC for native programming from the usability perspective.

    0 comments No comments

  2. LiHongMSFT-4306 29,981 Reputation points
    2023-07-13T07:55:20.2166667+00:00

    Hi @Guduru, Satyanarayana (DI SW LCS BOM)

    User's image

    Refer to this article for more details: Which is Better: ODBC or OLEDB?

    Best regards,

    Cosmog Hong


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.