Official Forum for Programming in Objective-C (the iPhone Programming Language) - Stephen Kochan

Old Stuff => Questions and Discussion => : gwalters June 29, 2011, 04:39:06 PM



: Databases
: gwalters June 29, 2011, 04:39:06 PM
Hello Steve,

How do you connect to databases in Objective-C? Can you connect to an Eclipse database?
When I say connect I mean open, write to, retrieve, and close the database.

I can't find anything on databases in any of the Obj-C books that I've looked at so far.
The only thing I'm finding is writing and retrieving to text files.

Would databases be memory efficient for iPhone and iPad apps?

Thanks for your help.

Gary


: Re: Databases
: fujilla June 30, 2011, 12:57:04 AM
Gary

Although I have not got that far myself, there are two main ways I know of regarding databases for iPhone/iPad.

Firstly, every iPhone (and probably iPad) has SQLite on it, so you can use SQLite databases.

Secondly, and this is probably regarded as the main way, is Core Data, which is an OOP database (if I am right), which you build inside of Xcode.

Hope that helps,
Nick
http://myfirstiphoneapp.co.uk (http://myfirstiphoneapp.co.uk)


: Re: Databases
: gwalters June 30, 2011, 09:33:29 AM
Where I typed "Eclipse" should have been "MySQL".

Also, if you can use SQL Lite than how do you connect to it?


: Re: Databases
: fujilla June 30, 2011, 10:01:53 AM
Unfortunately I have not got that far myself, so you will either have to see if someone else replies, or go to developer.apple.com, or google for an answer.

Sorry,
Nick
http://myfirstiphoneapp.co.uk (http://myfirstiphoneapp.co.uk)


: Re: Databases
: gwalters July 01, 2011, 09:13:36 PM
Steve, if you have the time would you please shed some light on this subject.
Thanks in advance for your help.

Gary


: Re: Databases
: skochan July 01, 2011, 11:02:17 PM
Yes, SQLLite is built into Mac OS X as well as iOS.   Start here for  to learn more about Core Date: http://bit.ly/iDslaq  (http://bit.ly/iDslaq).   Interaction directly with a SQLLite database is done with a C API.  Look here for more info for iOS apps: http://bit.ly/iJr5a6  (http://bit.ly/iJr5a6) and http://bit.ly/jbA7nS  (http://bit.ly/jbA7nS).

Cheers,

Steve


Sorry, the copyright must be in the template.
Please notify this forum's administrator that this site is missing the copyright message for SMF so they can rectify the situation. Display of copyright is a legal requirement. For more information on this please visit the Simple Machines website.