dongmubei7950
dongmubei7950
2010-11-23 18:13

将数据插入远程mysql数据库

已采纳

We have an android app that currently sends data to a php script which writes to a mysql DB on the same server. We are thinking of using a scalable remote DB e.g. amazon RDS.

The question is how does our android app write to these remote DBs? Do they have some kind of rest API, or do we have to send the data to the same php script on our server but use that to post to the remote mysql DB?

Thanks

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

2条回答

  • drlma06060 drlma06060 11年前

    It depends entirely on the remote database. Sift through their developer docs to find out what you need to do to work with them.

    You can most likely do either option you mentioned (interact directly through your Android app or use a PHP script on your server as a man-in-the-middle).

    Personally, I would go for a man-in-the-middle PHP script on your server that acts as an API, because it allows you to change remote DBs without changing/repackaging your Android app.

    点赞 评论 复制链接分享
  • duanchi0883649 duanchi0883649 11年前

    Perhaps either should be able to do the database insert; we do not know at the moment. You will need to determine if the middle tier is necesssary or if you will do all your processing on the device. For example, you may wish to use the middle PHP piece because it is easy to change, as opposed to the device. If everything were always the same, not matter what, you could send out directorly from the device given a secure link and give it is capable to do so in the first place.

    Since the future is hard to see, I'd stick with the PHP. This is based on the limited information you give here.

    点赞 评论 复制链接分享