简体   繁体   中英

What is the best way to connect an iphone app to a mysql database?

I want the way with the fastest execution time. I'm not feeling comfortable of using web service because i need to create separate php pages and retrieve data as xml. If you think its good to use web service please tell me why. I want to code my database queries right on my c/objective c pages.

I've been searching for libraries. I saw this sequel pro - won't i have any problems on using this - like licensing issues? I also saw this libmysqlclient of cocoa but some say its not working well. I've also read about a library developed by Karl Kraft found here http://www.karlkraft.com/index.php/2010/06/02/mysql-and-objective-c/ but don't know if i could trust this.

I would really appreciate you help.

Definitely build a web service to act as an abstraction layer to your database. Here are some significant reasons in my opinion:

Since you want speed, you will be able to add caching when using the webservice, so you will essentially eliminate the need for identical queries to run (sometimes).

If you need to change your data model later, you just have to modify the webservice backend and don't have to update your app.

You can better control security by not exposing the database to the world, and keep it safe behind the web service.

Your database credentials should not be stored in an app. What if you needed to change those?

I strongly suggest a web service. Hope this helps.

Connect to your DB by PHP and output the result as JSON is much better and faster then xml and less coding if use JSON Framework.

and never never try to connect to your DB from your iphone because it easy to sniff out the request from iphone.

Being safe then Sorry, keep that in mind

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM