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

Posted on 2006-03-27
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!
Question by:JasonOutlaw
    LVL 23

    Accepted Solution

    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:

    Author Comment

    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 and download the carbon app example they have, it can very easily be ported to objective c. Thanks for the help.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
    If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now