DIGIT-ARC read-only archive · snapshot: July 23, 2026

database connectivity with C/C++

7 posts · originally from https://geek.digit.in/community/threads/database-connectivity-with-c-c.88323/

P
peyoush_thakur Original post #1
May 19, 2008 at 10:48 PM
hi friends! can anybody tell me how to make database connection with C or C++?
QwertyManiac
May 19, 2008 at 11:06 PM
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
anshul #3
May 20, 2008 at 8:35 PM
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 at 8:48 PM
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
anshul #5
May 20, 2008 at 9:31 PM
"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 at 9:46 PM
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 at 3:09 AM
SQLite is a very simple DB. Here is an article explaining how to work with it from C++

- *www.sqlite.org/capi3.html