开发者

How to connect to remote mysql from iphone application?

i am newbie to iphone programming. I am working on an iphone project.

My question is:

How to connect my iphone application to a remote server mysql database directly? There are many ways to connect through PHP scrip/ json/xml/ webservices. But i dont need that. I would like开发者_运维知识库 to have direct connetion to mysql of remote server without any intermediate?


Basically you would need to build a mysql client lib for iOS and then use that from Objective-C. This blog post should get you started. As stated by peko you should really reconsider that you are doing the right thing. The mysql network protocol isn't exactly made for mobile clients where connections can drop, be unavailable, etc.


You shouldn't do this because someone could sniff the traffic and get the username and password for your database, or inject sql-code.


Here's a MySql objective-C client for iPhone. It was traditionally available only for OSX but they just released it for iOS:

http://www.karlkraft.com/index.php/2010/09/17/mysql-for-iphone-and-osx/

I haven't used it. I would still strongly recommend exposing via services. I would also be interested in why you need to directly connect to the DB and why services isn't appropriate :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜