views:

3278

answers:

6

Hi everyone,

I need some help into this problem:

Basically i want to connect my program which uses c/c++ to a SQL server database (MS SQL server express or standard edition) , because of our users demands the program needs to be ported to Mac Os too so this connection need to be portable. Any idea of a portable API i can use to do this?

Im thinking something like a boost ODBC api would be perfect but they don't do it.... Unless I'm wrong haha.

All Comments and Suggestions are welcome! - (Still Learning haha).

Many Thanks.

+1  A: 

Judging by this (and what I recall reading) ODBC is supported on Mac and Linux as well as, of course, Windows.

Onorio Catenacci
+4  A: 

I've used C++ UI frameworks in the past that contain classes to connect to MS SQL through ODBC. Since you are going cross-platform I think ODBC is the way to go.

wxWidgets has wxDB:
http://docs.wxwidgets.org/2.8.6/wx_odbcoverview.html#odbcoverview

Qt has the QtSql module:
http://doc.trolltech.com/4.4/qtsql.html#connecting-to-databases

Both frameworks are cross-platform on Windows and Mac OS. With Qt you may need to evaluate the licensing.

Chris Roland
+4  A: 

SQLAPI++

http://www.sqlapi.com/

Brilliant library, works with lots of DBs and us available for Windows or Linux. You won't regret it.

Rob
Note: sqlapi is not OpenSource.
User1
+3  A: 

SOCI is a boost-like (boost-inspired?) database library. I haven't had a chance to try it yet, but from the website it looks promising.

http://soci.sourceforge.net

Adam Mitz
A: 

OTL (Oracle Template Library) not only Oracle but SQLSERVER DB2, ODBC, Windows Unix...

Only one (long) header to include, need a C++ compiler.

call me Steve
A: 

A very similar SO thread.

luke