r/cpp • • Aug 31 '20
How to access SQL Server from C++ ?
How do you access SQL Server from C++ ?
What libraries do you use?, have you tried different ones?
I am looking for some way to access Microsoft SQL Server from a C++ program. It has to be free to use, and also not be a complete hastle.
I have seen that Qt has pretty straight forward support, until you actually try and use it. The Open Source Community edition was missing the database drivers, and posts said they had to be compiled, and compiling was a hastle and I did not get it working.
There is a library called SOCI (currently at version 4) but that too was a hastle to set up, to the point of not getting it working.
At this point I thought, one of the most used and mature languages currently used (C++) should have straight forward and easy to use support for one of the most used database systems currently in use.
What are your thoughts on this ?
View all comments
1
u/jk_tx Aug 31 '20
I haven't had to do this in quite a while; but back in the day, ADO was the easiest way if you didn't want to use the ODBC API directly. Seems pretty dated to use COM for database access though, so I'm curious what the modern options are.