I'm searching for a good C++ library for MySql, I read about MySQL++ and SQLAPI++, from your experience witch one should I use from this two or is there another library that you would recomand ?
Thank you.
A couple more to consider are SOCI and DTL. Most of the general purpose frameworks like Qt, Ultimate++, and wxWidgets include database access capabilities.
Mysql now distributes an official C++ library based on JDBC. I would use that unless there is some compelling reason not to(note there are plenty of those DB portability, licensing. )
Related
I would like to ask you if there is any library to make it easier to manage a couchdb database (in this case Cloudant) with C++.
I have read about Couchdbcpp but maybe there are some libraries which work better.
Thanks a lot!
If you're happy with a "C" library, instead of C++, then this library seems to be maintained and works against CouchDB or Cloudant:
https://github.com/jubos/pillowtalk
As far as I can tell couchdbcpp is not currently maintained and has not been for several years. Due to many improvements to couchdb and that Cloudant has more features than vanilla couchdb, my suggestion would be to use a C++ HTTP library to communicate with Cloudant. I am not a C++ dev so I cannot speak to the best library to use, but I found a site that looks to have a nice list of C++ libraries here:
http://en.cppreference.com/w/cpp/links/libs
CouchDB has REST api. You can make your own easily.
I made a couchdb C++ library based on nlohmann(json library) and cpr(curl for people). It is just 200 lines. Not a full featured one. But maybe you can start from here.
https://github.com/ParkSeungwon/couchpp
What is the most basic way to go to a webpage and download its contents? the webpage i wish to get only has text, most of which is in tables.
is there a std library that does it (like urllib in python)?
There's no official C++ network library, no. There are many different APIs available, though. Which is best for you would depend on what platform(s) you were targeting and what framework(s) you might already be using.
That said, cpp-netlib is a platform-neutral API that follows C++ idioms nicely. I've used it and it works.
A large number of tasks that are not covered by the C++ standard library can be done using boost, the collection of peer-reviewed portable libraries, which are used by pretty much every C++ project today. For networking, we use boost.asio.
Their tutorials include HTTP clients: http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio/example/http/client/sync_client.cpp and http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio/example/http/client/async_client.cpp
However, although this is highly portable and may end up becoming part of the C++ standard library in future, it is a bit too low-level for your task. libCURL is the today's default library for HTTP downloads.
What are the suitable database for Visual Studio C++?
How could I connect a database to C++?
Your choice of a database is fully dependent on your requirements. SQLite offers a nice and simple interface.
Beginners to Microsoft C++ should probably stick with SQL Server Express, since it is designed specifically to work with Visual Studio.
If you need a local database just for your application then check out SQLite. They have a C++ library that is quite easy to use and you interact with it via normal SQL syntax.
Most, if not all, popular DBMS provide a C connector. Some even provide a C++ one (generally a wrapper of the C driver).
So, I suggest you start by looking at which DBMS you want to use, then browse their documentation for how to obtain and use their driver.
Is there any solution other than the ugly ADO as it is not good and badly documented?
In the past, we used the DTL library and were relatively happy with it.
SOCI looks like something deserving attention too. I never used it, though.
You might want to take a look at the Qt toolkit, it provides an SQL interface that can talk to different database backends (including MS-SQL via ODBC).
QSql
Supported drivers
cheers,
mitch
You could use the sqlncli.dll library, but is a ugly method.
Give my CSQLBinding class a shot. It handles most everything for you.
What options exist for accessing different databases from C++?
Put differently, what alternatives are there to ADO?
What are the pros and cons?
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.
Although this question and its answers are several years old, they are still valuable for people like me that cruise by on an evaluation trip. For this reason, I would like to add the Qt C++ framework's QtSql module as an option for database connectivity.
Note that I am familiar with Qt in general, but have no experience with QtSql in particular.
Pros (just a few that should also apply if you just choose Qt for its QtSql module): Qt is cross-platform. In my experience, Qt is well-designed, pretty intuitive to use, and extremely well documented. It has been around for a long time, is maintained by an active community and backed by Nokia, so it won't become unavailable over night. Since 2009, Qt has been licensed under the LGPL, so it is a real no-cost option even for commercial applications.
Cons: Qt is not small. You will introduce new types such as QString to your project. Qt is licenced under the LGPL, so you need to acknowledge its use even in commercial apps.
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.
There is the POCO Data library, which supports ODBC, MySQL and SQLite. Part of the free open source POCO C++ Libraries.