开发者

Objective-C iPhone development: MySQL connection

I want to have access to a MySQL da开发者_开发技巧tabase (my website database) from an iPhone app. People told me to use SQLite but I'm not familiar with this. I want to know if it is possible to query a remote MySQL database in Objective-C on the iPhone.

Thank you.


SQLite and MySQL serve two very different purposes. SQLite is for local data storage - data are kept on the phone, access is fast and requires no Internet. MySQL is a client-server database - the database is somewhere in the cloud, access is over the 'Net, and all your users are exposed to the same database.

Depending on your business scenario, either SQLite or MySQL would be appropriate.

That said, accessing MySQL in the cloud is usually performed via a Web service layer. You create/upload a set of Web pages (PHP or ASP or something) that encapsulates all the necessary database calls, passes the parameters to the database and passes the results back. This way, on iPhone you only perform good old HTTP calls, not work with MySQL directly.

At least, that's how they usually do it in the world-facing apps. In a corporate environment, maybe there's a case for direct MySQL access. There's no ready-made client in the Apple toolset; check out the MySQL website, if they have a CocoaObjC connector.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜