What options exist for accessing different databases from C++? Put differently, what alternatives are there to ADO? What are the pros and cons?
+2
A:
- Microsoft ODBC.
- The MFC ODBC classes such as CDatabase.
- OleDB (via COM).
- And you can always go through the per-RDBMS native libraries (for example, the SQL Server native library)
- DAO (don't).
- 3rd party ORM providers.
I would recommend going through ODBC or OleDB by default. Native libraries really restrict you, DAO is no fun, there aren't a lot of great 3rd-party ORM for C++/Windows.
James D
2008-09-08 17:05:03
A:
One thing - if speed is important and your code doesn't need to be portable, then it may be worth it to use the native libraries.
I don't know much about SQL Server, but I do know that the Oracle OCI calls are faster than using ODBC. But, they tie you to Oracle's version of SQL. It would make sense for SQL Server to be the same way.
Mark Krenitsky
2008-09-08 19:05:27
A:
There is the POCO Data library, which supports ODBC, MySQL and SQLite. Part of the free open source POCO C++ Libraries.