Separate names with a comma.
Discussion in 'Mac Programming' started by Monkaaay, Dec 30, 2008.
Is there a library available for connecting to a SQL Server database using Objective-C/Cocoa?
Which flavour of SQL?
Microsoft SQL Server for now, but portability to others would be beneficial as well.
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.
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.
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.