Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing database using C

Tags:

c

database

mysql

I am working on a problem where I need to store and retrive the data from the database . I am using C for that on windows system . I am familiar with MYSQL database . I just need to know whether its possible for me to access database using C if yes which IDE I can use and how can I connect it to MYSQL .

like image 798
Voila Avatar asked Sep 11 '12 10:09

Voila


People also ask

Can you use SQL with C?

You can code SQL statements in a C or C++ program wherever you can use executable statements. Each SQL statement in a C or C++ program must begin with EXEC SQL and end with a semicolon (;). The EXEC and SQL keywords must appear on one line, but the remainder of the statement can appear on subsequent lines.

Can we connect C with MySQL?

MySQL database is available on most important OS platforms. It runs on BSD Unix, Linux, Windows, or Mac OS. To be able to compile C examples, we need to install the MySQL C development libraries. The above line shows how we can do it on Debian based Linux.

What are the database which we can connect with C language?

C/C++ Interface APIs Following are important C/C++ SQLite interface routines, which can suffice your requirement to work with SQLite database from your C/C++ program. If you are looking for a more sophisticated application, then you can look into SQLite official documentation.


1 Answers

Yes, you can connect your C code to MySQL using a connector (driver) available on MySql home page: http://www.mysql.com/products/connector/

There is a nice tutorial on writing C programs accessing MySQL: MySQL C API programming tutorial

You can use any IDE you want for writing your code, for example Visual Studio. Here you can download a free version: http://www.microsoft.com/visualstudio/11/en-us/products/express

like image 89
piokuc Avatar answered Oct 22 '22 01:10

piokuc