We help IT Professionals succeed at work.

Code example needed for COCOA Objective-C ODBC database access. 500 point question.

JasonOutlaw asked
Medium Priority
Last Modified: 2013-12-26
I need code that shows as simply as possible how to query a database via an ODBC connection using COCOA and Objective-C and put the results of the query in an array or text box.

What im trying to do is enter an employee number into a text box, query the db for that person, then update a field from the results. Also, I will more than likely put the results of all of the employees into a list box.

Simplicity is the key!
Watch Question

Top Expert 2005
NeXT's DBKit was the original Obj-C ODBC interface in NeXTStep.  However, it was a 2-tiered model, was woefully inadequate, and was replaced with Enterprise Objects Framework (EOF).   Unfortunately when the OpenStep specification was written, EOF was pulled from the core frameworks and the technology was incorporated into WebObjects, where it remains today.   Unfortunately if you want to use Objective-C, you are stuck using WebObjects v4.  Later versions are Java only.  [A gross error on Apple's part, IMHO (but then I believe WO has been grossly mismanaged by Apple since the NeXT buyout).]

Mac OS X 10.4 introduced CoreData, which supports database persistence.  AFAIK, the only database it currently supports is SQLite.  I imagine that some of the EOAdapter (drivers for individual databases) technology might be migrated to CoreData in the future, but I would not hold my breath.

Going outside Apple-supplied technology, there are several third party Obj-C ODBC packages available:

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts


I found out a lot of this doing research while i was waiting on someone to give me an example.
What I found was if you install the iODBC framework from www.iodbc.org and download the carbon app example they have, it can very easily be ported to objective c. Thanks for the help.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.