This is the purpose of the ODBC libraries - they provide a database-neutral means of accessing most any database without changing your code. Before ODBC existed, I wrote an ODBC-like API for manufacturing systems, and a set of loadable shared libraries for each supported database (Oracle, Sybase, Informix, Ingres, and Interbase) that accomplished the same thing. Trust me, you don't want to reinvent that wheel! But, it worked great, and is still in use in a number of major manufacturing cell control systems 25 years later.
Is it possible with DOS compiler or need vc++ like
What OS are you using? If DOS/FreeDOS, you should still be able to get the ODBC C libraries. If VC++, then it should not be an issue. You can also use open-source compilers on Windows such as MingW (a GNU C/C++ compiler) that will work with ODBC as well.