1

I want to program against various databases in C. I want to know if all of the major database providers, Oracle, DB2, Sql Server, MySql have an api to use for C. If they all do can you give me some links to what the are but more specifically, how to work with the api?

thanks

1
  • 2
    All the major vendors have their own C APIs, but Neil is definitely right that ODBC is the way to go. That will allow you (relatively) easy swap databases while using the same interface. I recommend Easysoft's tutorial (easysoft.com/developer/languages/c/odbc_tutorial.html) to learn how to use the API. Commented May 9, 2009 at 22:53

2 Answers 2

6

The industry standard for database connectivity is ODBC, which is a C API. This Wikipedia link provides a brief overview and lots of links to other resources.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use ODBC. But thats not a good idea, cause of the performance impact it may have on your application.

The answer to your question is yes. All major databases provide some api of their own for you to communicate directly with your database.

The only problem with your question is that you forgot to tell which operating system you will be developing for. The only api i remember right now for those majors databases is libpq (for PostgreSQL). Usually in the developer's website its possible to find apis for languages like C and C++.

4 Comments

ODBC has no particular performance problems and is in fact the native API for several databases.
"The question to your answer is yes."? :-)
Ok, but odbc adds extra functionality to database communication and may be slower than other alternatives. There are other disadvantages of odbc anyway. Usually, native specific apis do a better job.
ahhaahah, true "The question to your answer is yes." ahahahah lol

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.