C++ SQL database library comparison [closed]

2020-05-15 14:55发布

问题:

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 7 years ago.

I am starting development on a medium-scale C++ project that has to work with a Microsoft SQL Server database. I have done database work before using .NET technologies but I don't find using a .NET approach to be appropriate this time. I would like to get some feedback concerning the various free (as in GPL, LGPL, Boost) C/C++ SQL libraries available. I found MySQL++ and SOCI to be pretty interesting and I would like to know which one you guys prefer and why.

Also, although this project will primarily be run on Windows workstations, I prefer developing under Linux so cross-platform compatibility is an advantage.

Thank you all for your time, I really appreciate your advices !

Jeremie

EDIT : Sorry about the typo, I meant Microsoft SQL Server and not MySQL Server.

回答1:

I can highly recommend OTL.

Not only does it support all major DBs, it's also very STL-ish and is generally written according to to proper C++ methodology (IMO). It worked for me just fine on VC8 (I used the MySQL ODBC connector).

Moreover, it's a one-header library. So there's no linkage issues or anything. Just include the header and you're done. You're 3 lines of code away from querying a MySQL table.

I've used it over the past few months, and also had a good experience communicating with its developer, asking questions, etc.



回答2:

I recommend SQLAPI++. It's shareware so you can try it for free and the support is excellent. Works for Windows and Linux.