使用Xcode和Objective-C连接到MySQL数据库 [英] Connecting to a MySQL database using Xcode and Objective-C

查看:539
本文介绍了使用Xcode和Objective-C连接到MySQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直对在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:


  1. iPhone使用HTTP向WebServer发送请求

  2. 连接到MySQL数据库的Web服务器

  3. Web服务器将数据返回给iPhone(XML,纯文本)

  4. iPhone处理数据

  1. iPhone POSTING a request to the WebServer using HTTP
  2. Web Server connecting to the MySQL database
  3. Web Server returning data to the iPhone (XML, plain text)
  4. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆