使用Xcode和Objective-C连接到MySQL数据库 [英] Connecting to a MySQL database using Xcode and Objective-C
问题描述
我一直对在iPhone或Mac项目中使用MySQL数据库感兴趣。如何在Objective-C中执行连接?
I have been interested in working with a MySQL database in my iPhone or Mac projects. How is a connection performed in Objective-C?
我只有一点PHP经验,但是,这有点太不同了= /
I only had a bit of experience with PHP, but heck, that is a bit too different =/
推荐答案
检查本教程用于与SQLite连接。
Check this tutorial for connectivity with SQLite.
你将无法使用直接从iPhone连接到MySQL。您必须使用一些中间层,例如使用PHP的Web应用程序。
You will not be able to connect to MySQL directly from the iPhone. You must use some intermediate layer such as a Web application with PHP.
所以,你会有这样的东西:
So, you will have something like this:
- iPhone使用HTTP向WebServer发送请求
- 连接到MySQL数据库的Web服务器
- Web服务器将数据返回给iPhone(XML,纯文本)
- iPhone处理数据
- iPhone POSTING a request to the WebServer using HTTP
- Web Server connecting to the MySQL database
- Web Server returning data to the iPhone (XML, plain text)
- iPhone processing the data
你可以使用这种技术来查询和插入/更新/删除数据。
You can use this technique to query and insert/update/delete data.
一旦找到这个用于MySQL的库,我知道它是如何工作的。
Once I found this library for MySQL, and I am aware how it works.
这篇关于使用Xcode和Objective-C连接到MySQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!