0

i want to fetch data from web server and save it in my local database through sqllite.How is it possible.

demongolem
9,75436 gold badges98 silver badges107 bronze badges
asked Mar 16, 2011 at 7:42
0

3 Answers 3

1

You can fetch data from webserver using JSON and webservice and then parse the JSON Response string.

Then you may create insert statements from the data obtained and execute it to insert in your database using executeNonQuery method of SQLite.

Best option is to do all this on appDidFinishLaunching so that there would be initial delay but then whole app after that would not face any performance issues i.e. No delays

Hope this helps you.

answered Mar 16, 2011 at 8:46
Sign up to request clarification or add additional context in comments.

Comments

0

Well,

it depends on what kind of data you want to fetch. If you want to fetch XML from the webserver, you will get a nice list of xml parsers on this site: http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project

Another nice option for fetching any kind of data from the webserver is curl. You can find static libraries on this page: http://code.google.com/p/ios-static-libraries/

Well, there's always the option to use the iOS native libraries, which are documented (with examples) in the iOS SDK.

answered Mar 16, 2011 at 7:50

1 Comment

i want to fetch JSON from web server and when once the data is fetched it should be simultanously saved to my local database
0

I would not recommend using "raw" SQLite these days unless you have an exceptional reason to do so. Core Data is the way forward.

I'm not really sure what your question is; it's so broad. But, in general, you'd create an NSURLConnection, download the data, parse the data and store it in your database. Each stage is pretty well documented and there are lots of questions here on each stage.

If you use Core Data there are also some open source projects, such as RestKit, that might give you a good starting point.

answered Mar 16, 2011 at 9:34

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.