tags:

views:

201

answers:

2

I am working in Ansi C, windows platform. I want to attach mysql database to my c program. Kindly guide me how I can make it possible.

+3  A: 

Here is a working example which sets up a connection and performs a query.

stacker
Thanks Stacker for your link.. Actually i working on window platform and I have wamp server for mysql database, I there any way to connect my c application with wamp server.
Arman
The source code is the same on windows, you just need to compile it differently - which is pretty much just a matter of setting include paths and libraries to link to.
nos
A: 

ANSI (ISO) C doesn't do networking, so by definition you can't do MySQL connections in ANSI C. You will have to move to POSIX at least. So, the answer is, "It is impossible."

Alok
I widows platform which lib I have to include instead of POSIX?
Arman
@Arman: you will need MySQL C library: http://dev.mysql.com/doc/refman/5.0/en/c.html. But your question mentioned ANSI C. You can't do it in ANSI C, although I don't know if you really require ANSI C or you just said that without understanding what it meant. Go to http://dev.mysql.com/downloads/connector/c/#downloads and download the windows version for the library, and read their documentation.
Alok
@Alok I know POSIX is not the standard library, I want to use standard libraries, but in those cases in which ANSI doesn't support, I have to go to other libraries which is non-standard.
Arman
For writing MySQL client code in C, the MySQL C libraries are going to be the most portable. They are available for a variety of systems.
Alok