Retrieving data from a remote database

前端 未结 2 1194
醉话见心
醉话见心 2021-02-06 16:03

could someone please explain to me the process of retrieving data from a remote database? I understand how to parse data from sqlite to an iPhone application however remote data

相关标签:
2条回答
  • 2021-02-06 16:48

    That are many ways to build a system where you have a client application that retrieves data from a "remote" system that runs a database. You have many many choices as to what the server runs, and what the client is... and there is a world of technologies involved in this...

    Since you are interested in learning, I would suggest you to take into consideration a very common architecture for such systems and dig into it.

    One such example is LAMP (Linux, Apache, MySQL, PHP) and you can find a good tutorial at this site.

    The tutorial covers everything you need, from setting up the systems, to retrieving the data and passing it back though the web; it's step by step and pretty easy to follow. The only thing that is not covered is JSON, but JSON in the end is just a format to pass data back and forth, and you can easily learn the basics about it with this tutorial.

    Finally, I would suggest looking at how building an iPhone app getting JSON data. This would be the point where you join the two previous tutorials.

    0 讨论(0)
  • 2021-02-06 16:49
    1. If you have a web service protocol on the server side, you can use JSON based web service to retrieve your data. If you follow any JSON tutorial, you can see JSON is just a text representation of the data.

    2. Or you can simply use a post request to your server, which can response by simple XML with your own defined tag. So that you can use NSXMLParser to parse the data in your iPhone and decode information from there.

    Any kind of database in the remote site will work. I prefer the free open source MySQL database.

    With JSON web servie, you need some JSON converter for your database in the server side and also in the client side. A good open source client tool is SBJSONParser.

    But if you use XML, you can define your own tag to encode and decode you database fields and information.

    0 讨论(0)
提交回复
热议问题