29

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.

user438383
  • 5,716
  • 8
  • 28
  • 43
El Weon
  • 385
  • 1
  • 3
  • 12

2 Answers2

32

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.

Assaf Lavie
  • 73,079
  • 34
  • 148
  • 203
  • I've used OTL on an Oracle project before and have been reasonably happy. It's not perfect, but it does the job well enough. – Austin Ziegler Jun 09 '09 at 18:26
  • Very interesting library indeed. Do you know where I can find a good tutorial ? It seems like SQL Server is not often supported by C/C++ libraries. – El Weon Jun 09 '09 at 19:17
  • I haven't seen a tutorial out there, just the dozens of examples it has for each DB system. I think if you take a look you'll see that it's really easy to get started with this library. – Assaf Lavie Jun 10 '09 at 04:12
-2

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

Rob
  • 76,700
  • 56
  • 158
  • 197
  • 8
    I considered it but the price tag (around 299$ if my memory serves me well) is bit too high. Corporate politics... I will not get into that but i'm sure you understand what i'm talking about. – El Weon Jun 09 '09 at 18:43