Zack
Zack

Reputation: 13952

c++ database connection to mysql

I am trying my hand at an application in c++, and I'd like to have it be able to access a MySql (or some other relational) database. I want to be able to access a database of people's profiles, as well as update and change fields. Is there some sort of library to use? I really have no idea of where to begin.

Upvotes: 2

Views: 3267

Answers (3)

Bruno Alano
Bruno Alano

Reputation: 643

Use the MySQL C API. It's fast and easy. Look the documentation here: enter link description here

It's the native MySQL API.

Or if you need to handle other librarys, use an ActiveRecord library in C++. One example is: enter link description here. You can work with PostgreSQL and MySQL with the same query.

Upvotes: 0

Adrian Cornish
Adrian Cornish

Reputation: 23848

I help maintain http://tangentsoft.net/mysql++/ - and I think its an excellent library - but then again I am biased.

Upvotes: 2

Misguided
Misguided

Reputation: 1302

The code for accessing any kind of database will always be reliant on which wrapper for the database you would like to use. In any case, a quick google search for "MySQL C++ wrapper" turned up this very interesting official page on mysql drivers. Which contains a download link to the official C++ API, along with some notes on its page. I don't know if the official driver is the best one out there, but it seems to be pretty nice and you can be sure that it will still be supported for as long as you use MySQL.

I wish you luck.

As a side-note, I've used MongoDB's C++ driver, and it was pretty good. Yet MongoDB is a NoSQL database and might as well not be suited for your needs, although I suggest you look over it.

Upvotes: 6

Related Questions