结合使用Amazon RDS和android应用程序 [英] Using Amazon RDS with android application

查看:80
本文介绍了结合使用Amazon RDS和android应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景

我有一个EC2实例,并带有与其关联的RDS实例(MYSQL)。
我想使用一个Android应用程序对该MYSQL实例执行查询。亚马逊的Android sdk不支持RDS。

问题

如何将我的Android应用程序与RDS实例连接?是否可以将RDS(MYSQL)与不支持sdk的Android应用程序一起使用?

Background
I have a EC2 instance with a RDS instance(MYSQL) associated with it. I want to use a android app to execute queries on that MYSQL instance.The Android sdk of amazon does not support RDS.
Problem
How do I connect my android app with RDS instance?Is it possible to use RDS(MYSQL) with an android application without sdk support?

推荐答案

RDS不是数据库引擎。这是一项服务,可为您管理基础架构,以维护高可用性和容错数据库。它支持许多不同的引擎,例如您提到的MySQL。请阅读文档以了解更多信息。

RDS is not a database engine. It's a service that manages the infrastructure for you that's required to maintain a highly available and fault tolerant database. It supports a number of different engines such as MySQL as you mentioned. Please read the docs for more information.

您需要以与连接任何MySQL数据库相同的方式连接到RDS MySQL实例。使用支持MySQL的库,并使用数据库的主机名,用户名和密码。

You need to connect to your RDS MySQL instance the same way you would connect to any MySQL database. Using a library that supports MySQL, and using the hostname, username and password for your database.

但是,将电话客户端连接到数据库可能不是最佳的设计远程地。最好的办法是在与数据库接口的AWS上放置一个REST API。

However, it's probably not the best design to have phone clients connecting to your database remotely. The best thing to do would be to put a REST API on AWS that interfaces with your database.

让n个用户使用您的应用程序从每部手机连接到您的数据库可能不是一个好主意。这意味着您需要在数据库中拥有更多功能,极大地阻碍了您的可伸缩性,并且由于数据库暴露在互联网中而使事情变得不那么安全。有了它前面的API,您可以构建更具容错能力,可扩展性和解决方案的服务器。

Having n users connected to your database from each handset using your app is probably a bad idea. It means you need to have more power in your database, greatly hinders your scalability and makes things less secure as the database is exposed to the internet. With an API in front of it, you can build a much more fault tolerant, scalable and solution.

构建移动应用的云方式是(在一定程度上) )在云上构建您的应用程序逻辑,只需将您的客户端代码连接到您的API。这样,您无需为每个平台管理单独的应用程序级代码,就可以轻松地扩展到更多平台(例如IOS,Web)。您只需要管理与现有API集成的代码即可。

The "cloud way" to build mobile apps is to (within reason) build your application logic on the cloud and simply have your client code connect to your API. This way you can spread to more platforms (eg. IOS, Web) much more easily as you won't have to manage separate application level code for each platform. You'll just need to manage code that integrates with your already existing API.

看看此白皮书 。忽略Web服务器层,而专注于App Server和数据库层。这可能是最好的设计。

Take a look at this whitepaper. Ignore the web server tier and focus on the App Server and Database tiers. This is probably the best design to go by.

这篇关于结合使用Amazon RDS和android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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