views:

104

answers:

1

Since i am new to iphone and mac dev, which is the suggested way to connect your application to an sql server/sql server express 2005 database (in my case to sync data with sqlite)?

Thank you

A: 

I would suggest that you look to setup web services to do custom synchronisation - sqlite is not MSSqlServer in any way shape or form, and I am not aware of any libraries that will do auto sync, so the best approach is likely to be to take the domain knowledge of how your data (or your entities) can change at each end of the process, and write web services to reflect those changes: sorry - no magic bullet for this one.

(Edited to add) the Web services server end would be MS and the web services client would be the iPhone.

Andiih
Hi Andiih, thanks for your answer.I am aware that auto sync is out of the question - plus in my case i do not require porting the whole db, just parts of it.Regarding the services, are they also available to sql express?Which method is best - faster for this? XML? JSON? Anything else?
immuner
I'd construct dot.net web services - you can get some versions of SQL server to return XML directly, but dot net web services are cleaner and easier. I prefer JSON over XML on the iPhone but getting dot net to return JSON is almost straight forward, but I found I needed to set the response type to do it (I used the ASIHTTPRequest library on the iPhone end) google will find you plenty of resources (probably on this site!).
Andiih
how would you handle cases though that the user needs to send data that he has changed over the webservice with the way you provided? changed a couple of parameters is ok using POST, but what if he has changed a respectable amount of data? how would you handle this case?
immuner
basically, i'd say asynchronously, and as soon as possible. As long as the users UI is not being blocked by the updates its OK to stream the changes in the background. Its probably better to generate more small updates frequently, and handshake the results than few large updates. That way if the users quits the app most changes will already be synced.
Andiih