开发者

cross-platform SQL DB API c/c++ [closed]

Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 5 years ago.

Improve this question

I am writing a database application in C linux. Currently I work on mysql but later we might migrate to postgres. Therefore my boss has asked my开发者_JAVA百科 to prepare the application to be able to use either of the databases(mysql or postgres).

Is there a free api which I can use for this purpose? Or any suggestion on how best I can do this?


The official answer to that is ODBC.

If you don't like that (and let's face it, no one really does), Qt has a database access module, QtSql. Obviously, this will require you to make heavy use of Qt in your application.


If you can find drivers for your platform, ODBC was supposedly meant to provide exactly this: a platform-independent way to talk to databases.

(I say supposedly because in my experience, ODBC is such a mess that hooking up to an ODBC driver once turned out to be more difficult than just writing the code three times for three different databases.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜