Categories
Featured iPhone Development Resources

Iphone Sqlite vs. Core Data – Which to choose?

Prior to the release of OS 3.0 on the iPhone, SQLite was the choice for database implementation on the iPhone.  Since the addition of core data to the iPhone SDK, using SQLite with low level C function calls is no longer the only option, and now a question often asked is about which to use.

First, let’s take a look at using SQLite directly.

– Relational Database System
– Potential for cross platform compatibility
– Many early iPhone database examples were written using SQLite
– Objective-C wrappers such as FMDB are pretty easy to use

Now at Core Data:

– Can store data in it’s own Binary, or SQLite storage format.
– Can serialize objects
– Much higher level than using SQLite directly
– Not a RDBMS you could actually just store things directly.

Now the real question is, which is easier to use?  Well, that really depends on what you’re doing.  In an app I recently created all I had to do was read small amounts of data sequentially from a SQLite database, since this is such a simple task I simply used FMDB along with iPhone SQLite.  Now, if I needed to do anything with the data beyond reading it, Core Data can make all this much easier, and I’d recommend using it.

Conclusion: Core Data just makes so many things so much easier that I would recommend using it unless you already have existing code, or are doing only the most basic database usage.

14 replies on “Iphone Sqlite vs. Core Data – Which to choose?”

You are incorrect on one point. The iPhone version of Core Data does NOT support XML. This is a huge omission on Apple's part as it makes it very difficult to transmit objects over the network to a server.

You are incorrect on one point. The iPhone version of Core Data does NOT support XML. This is a huge omission on Apple's part as it makes it very difficult to transmit objects over the network to a server.

Another good SQLite library is Ziminji’s SQL Query Builder. This library has an amazing number of classes to pick from and use. It simplifies the implementation process a lot. It way more advanced than FMDB. It is one of the few that handles multi-threading and adds some extra security to your apps.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.