What is the best way to connect iphone application to mysql database?

I need a method with the fastest runtime. I don't feel comfortable using the web service because I need to create separate php pages and retrieve the data as xml. If you think this is useful for using a web service, please tell me why. I want to encode my database queries right on my c / object c pages.

I was looking for libraries. I saw that this sequel is about - unless I have a problem with this - like licensing problems? I also saw this libmysqlclient cocoa, but some say it works poorly. I also read about the library developed by Karl Kraft, here http://www.karlkraft.com/index.php/2010/06/02/mysql-and-objective-c/ , but I don’t know if I can trust this.

I would really appreciate your help.

+4
source share
2 answers

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

Since you want speed, you can add caching when using a web service, so you essentially get rid of the need to run the same requests (sometimes).

If you need to change your data model later, you just need to change the webservice firewall and do not need to update your application.

You can better control security by not revealing the database to the world and not hiding it behind a web service.

The credentials of your database should not be stored in the application. What if you need to change them?

I highly recommend the web service. Hope this helps.

+2
source

Connect to your database using PHP and print the result as JSON much better and faster than xml and less coding if using the JSON Framework.

and never try to connect to your db from your iphone, because it is easy to sniff out a request from iphone.

Being safe then Sorry, keep that in mind

+1
source

All Articles