R – How to import data from Microsoft Access / SQL Server 2005 into Core Data

core-dataiphone

I am sitting on a ton of data in a SQL Server 2005 database, from which we dump Access databases as a cache.

I want to create an iPhone app based on Core Data that can use this data from my SQL Server 2005 database, or the Access dump.

Based on all of the Core Data tutorials and documentation it appears that I have to use Xcode to create a Core Data schema and populate that schema using Xcode.

SQLite seems like the right thing to act as a dump point, then use SQLite APIs. But this doesn't bridge nicely to Core Data in my mass data scenario.

Apple has obsoleted the SQLite Books Example seemingly with the sole intent of making sure that you use Core Data and not SQLite.

Has anyone come up with a dump scheme for data locked in an Access or SQL Server 2005 DB into an iPhone friendly format? I don't care if it is Mac OS X code, iPhone code, or .NET code… Anything?

In my case I am talking about 26MB of data that I would like to have an offline cache to for my application.

26MB of XML seems like a bad idea. 26MB of SQLite seems like a great idea. 26MB of Core Data seems like an even better idea.

Thanks in advance,
–Batgar

Best Answer

You could create an Objective-C app in XCode using the FreeTDS library to pull data down from your MSSQL database and populate your CoreData store.

http://sourceforge.net/projects/freetds/

There's also a commercial product that provides an MSSQL ODBC driver for Macs, which you could then call from your data migration code:

http://www.actualtechnologies.com/product_sqlserver.php

If that doesn't work, you can set up the MSSQL database with an IIS front-end and retrieve the data using XML queries. Starting with MSSQL 2000, there's a way to query the server directly via HTTP and get back results in XML without having to write any ASP/ASP.NET code.

Related Topic