# database connectivity with C/C++



## peyoush_thakur (May 19, 2008)

hi friends! can anybody tell me how to make database connection with C or C++?


----------



## QwertyManiac (May 19, 2008)

The database you wish to use will have its own set of libraries to use from. If you tell us what kind of database are you attempting to connect from your C(++) application to, we can help better.


----------



## anshul (May 20, 2008)

I also came here to ask a similar question.
Using filesystems can't we make file associations to every other type of file like for example database file with .mdb extension.
I gave It a simple trial but it does not open in text or in binary mode.
Is it possible??


----------



## QwertyManiac (May 20, 2008)

Extensions are just indicative in nature and serve no other purpose other than being that. The file's contents are in no way related to the extension its name carries. So no, file-systems and extensions are not related either and you can not do what you are trying to via that way.


----------



## anshul (May 20, 2008)

"Extensions are just indicative in nature and serve no other purpose other than being that. The file's contents are in no way related to the extension its name carries. So no, file-systems and extensions are not related either and you can not do what you are trying to via that way." 

Then please suggest how to create a database in C/C++


----------



## QwertyManiac (May 20, 2008)

You can use one of the many APIs to connect to / edit / create / modify / delete databases and their components. For instance, MySQL provides an API MySQL++ for use with C++ language. Likewise, depending upon your choice of Database you can get them from their official sites.

As for simple accessing and create/edit/modify/delete of its records/tables, you can use generic drivers, Visual C++ would have help files on those, check them out. I have only used these functionalities from within Visual Basic so I do not know the C++ requirements.

Simply search databases on MSDN's C++ page perhaps, if your domain is Windows. If Unix, you should find enough docs in /usr/share/doc already 

P.s. If its a small one just use simple hash tables


----------



## knight17 (May 25, 2008)

SQLite is a very simple DB. Here is an article explaining how to work with it from C++

  - *www.sqlite.org/capi3.html


----------

