Connecting directly to remote MySQL database in iOS -


i developing iphone app. want fetch database remote server , show in app, want know whether should directly connect remote mysql database or if it's recommended use third layer php, asp.net, etc. retrieve data remote database.

whilst can use mysql client library on ios, there few reasons i'd recommend using "third layer" intermediate approach:

  1. security - want embed database, username , password details in app? (even if it's "select only" account.)

  2. performance - why not cache of result data if @ possible, rather relying solely on whatever mysql database engine you're using. caching take place @ both ends (the scripting language , local storage on ios device offline use).

    for example, depending on load/how data changes cache data @ web service level (perhaps storing in memcached or similar instead of executing query , hitting database server every time). likewise, once you've fetched data web service onto device, cache there. (potentially via local sqlite store, or serialised arrays, appropriate.)

    also, if ever want use multiple backend database servers, transparent app's perspective.

  3. maintenance - if communicate relevant data ios app either via json or xml, you'll allow reasonable degree of change database schema without potentially breaking existing apps have been deployed.


Comments