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
2010-01-25 08:11:50
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
2010-01-25 08:15:35
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
2010-01-25 08:41:37
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
2010-01-25 08:13:58
@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
2010-01-25 08:19:36
@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
2010-01-25 09:25:30
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
2010-01-25 09:31:26