如何在iOS中连接Amazon RDS MySQL [英] how to connect amazon rds mysql in iOS

查看:100
本文介绍了如何在iOS中连接Amazon RDS MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个iOS应用程序,该应用程序使我在Amazon上的RDS mysql有了任何想法,如何在iOS中连接Amazon RDS.

I am making an iOS app for which I have made the RDS mysql on amazon any idea how to connect the amazon RDS in iOS.

<?php
// we connect to example.com and port 3307


define("HOST", "dbinstance.jjjjj.us-east-1.rds.amazonaws.com");



define("USER", "test"); // Replace the ??'s with your database user login name
define("PASSWORD", "test"); // Replace the ??'s with your database user's login password
define("DB", "test"); // Replace the ??'s with your database name



$connection = mysql_connect(HOST, USER, PASSWORD) or die(mysql_error());
$database = mysql_select_db(DB) or die(mysql_error());


?>

推荐答案

您没有.移动应用程序永远不要直接连接到数据库服务器-这样做存在安全风险,因为它允许具有数据库凭据的任何用户(即,任何下载您的应用程序的用户!)连接到数据库并读取或修改任何数据.不受限制.

You don't. Mobile applications should never connect directly to your database server — doing so is a security risk, as it allows any user with the database credentials (that is, any user who downloads your application!) to connect to your database and read or modify any data without restriction.

在这里可以看到由这样的体系结构引起的破坏的一个例子,当有人发现游戏开发者的这种在线工作方式被破坏时,游戏开发者的游戏在线高分系统和关卡编辑器被销毁了:

An example of the havoc that can be caused by an architecture like this can be seen here, where a game developer had their game's online high scoring system and level editor destroyed when someone discovered that it was working this way:

http://forums.somethingawful. com/showthread.php?noseen = 0& threadid = 2803713& pagenumber = 258#post398884189

创建一个Web服务,该服务为您的数据库实施必要的操作(包括访问控制),并使您的iOS应用程序与其连接并进行交互.

Create a web service which implements the necessary operations for your database, including access controls, and have your iOS application connect to and interact with that.

这篇关于如何在iOS中连接Amazon RDS MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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