Connecting Android app to amazon RDS

2020-06-17 05:34发布

问题:

I have an Android application and I want to move my local database in the cloud. I decided for a SQL database and not for a NoSQL, because I want to execute complex queries. I created a database instance in RDS from Amazon and I populated the database.

Now I want to connect my mobile app to my cloud database. I sow samples for NoSQL database connection, but I wasn't able to find examples for RDS. I saw that it is recommended to create a web service and connect to that web service, but it seems much more complicated than using a NoSQL and this doesn't feel right.

Does Amazon offer some API/service for Android - RDS connection? Do you know any sample code that handles this aspect?

回答1:

Does Amazon offer some API/service for Android - RDS connection?

No. AWS does not currently have an API for interacting with an RDS instance.

Do you know any sample code that handles this aspect?

You may want to access your database with PHP and get a JSON response. If your RDS instance is using MySQL then you’re in luck. There is already a lot of documentation on connecting Android to MySQL using PHP. You can get great sample code and instructions on this blog post.
Here is a very popular reference for connecting Android and MySQL.