Answer the question
In order to leave comments, you need to log in
C++ ODBC cross-platform?
Good afternoon, Khabrovites, I am engaged in cross-platform application development, I try to make them lightweight and because of this I recently switched from Qt to wxWidgets. The problem is that the latter does not have the means to work with the database. (Most recently covered)
I googled and found several options:
1) One team makes its own technology for working with Postgres separately from the wx team. So they called wxPostgres.
Problem: Perhaps in the future I will change Postgres to something else, and then I will have to rewrite projects.
2) Find a cross-platform C++ library for working with ODBC.
Problem: I don’t know which one to choose so that it is under 3 platforms (Windows, Linux, MAC OS X).
3) Use pure ODBC API.
Problem: Long way to go and "have to" write your own classes.
Who has in cross-platform programming, can you share it? Thanks in advance!
Answer the question
In order to leave comments, you need to log in
Okay, you'll have to answer yourself.
Both MySQL and Postgres have some libraries for working with C++ (libmysqlclient and libpq++ respectively). I think they exist similarly for other DBMS.
Tried so far only under Linux. Under Windows it is more difficult, but I think everything can be solved too.
wxWidgets may be lighter, but they are noticeably slower than Qt, and almost never developed. I see no reason to use them at all.
Under linux and windows I use libodbc++ (see libodbcxx.sourceforge.net ). The quality of the code is so-so, but the interface is as close as possible to JDBC. On *nix (maybe Mac too - I don't know) it's better to use unixODBC as an ODBC implementation (see www.unixodbc.org ). Here you can look at the usage example and find information about the PostgreSQL driver.
If I have time I will try to write a post on this topic.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question