tags:

views:

87

answers:

4

is it possible to connect to an mysql database and issue queries using c++?
i found some sample code from the internet but they all use mysql! so u need to install mysql first on the computer.
what i want is to use a program from different locations where i don't have mysql installed to access a remote mysql database.
is this possible?

+1  A: 

You need mysql client libraries. You don't have to have mysql server installed. Details depend on your environment/packaging/etc.

Michael Krelin - hacker
A: 

Try libmysql. You would probably need to write your own C++ wrapper for libmysql calls but it's worth it. And, yes, you don't need to have local server installed.

Kotti
+2  A: 

Warren Young has made a C++ library call Mysql++ you can find more info at: Mysql++

You could also take a look at: libmysql

RJD22
Thanks for the mention! The original poster's confusion is that in the past, the easiest way to get the MySQL C API libraries that the various C++ wrappers for it depend on is to install the MySQL server on the development machine. A few months ago, they broke it out for the first time, calling it Connector/C. I just barely tested it with MySQL++ and it works fine. I just haven't gotten around to updating the MySQL++ pages and docs to talk about this option yet.
Warren Young
A: 

I'm using MySQL Connector C++ to connect to a database. This is on Windows XP and Vista. I'm using it with Visual Studio 2008.

Your program creates a connection by specifying the URL to the computer where the database resides. Thus many instances of the application can access a remote database.

Thomas Matthews