Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4440
  • Last Modified:

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

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!
1 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:
JasonOutlawAuthor Commented:
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.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now