Does anyone know of a simple way for a C++ program to communicate directly with a MySQL database? I have looked at MySQL++ and found it to be very confusing. If anyone kno
There are quite a few database API wrappers but my favourite - and the one I recommend - is the SOCI library. Much nicer syntax than using the raw C API.
The 'motivating' example from the SOCI website:
int id = ...;
string name;
int salary;
sql << "select name, salary from persons where id = " << id, into(name), into(salary);
The C MySQL API is just like using the PHP MySQL extension and so should be pretty familiar. If you are comfortable with C, I'd recommend that (and you don't mind mixing C in your C++).