Connecting to SQL Server with Objective-C

Discussion in 'Mac Programming' started by Monkaaay, Dec 30, 2008.

  1. Monkaaay macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #1
    Is there a library available for connecting to a SQL Server database using Objective-C/Cocoa?
     
  2. Cromulent macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #2
    Which flavour of SQL?
     
  3. Monkaaay thread starter macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #3
    Microsoft SQL Server for now, but portability to others would be beneficial as well.
     
  4. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #4
    Do you mean microsoft SQL server, or some other RDBMS that uses SQL? If the former, I would try to find a library that alllows ODBC access in C. You can call into this library from Objective-C, and make a wrapper class around its functions if desired. Note that I have not had to solve this myself, so these are just my suggestions based on the approach I would take.

    -Lee
    Edit: too slow. If you want to be able to move between databases I would definitely write an interface that abstracts the DB, then implement that once per DB you need to target. This way no app code will need to change, since it will just use interface methods.
     
  5. Monkaaay thread starter macrumors 6502

    Monkaaay

    Joined:
    Jun 19, 2006
    Location:
    Richmond, VA
    #6
    Solid advice, and I've done similar in Java and C# for other scenarios. My knowledge of Objective-C is non-existent so I'm not confident in being able to achieve that right now.

    Would you still use ODBC in your abstraction suggestion for multiple RDBMS? I did a little bit of searching around and I'm finding small hints at using ODBC for my situation, so it's nice to hear someone else echoing that path.
     

Share This Page