duangu9173 2015-04-13 13:30
浏览 173

如何使用Web App和Android App访问SQL数据库

What is the best way to have a SQL database that can both be accessed by an android device via java code and by a web app via php code?

In my mind I imagined a MySQL database somewhere on the cloud that is accessed in all the normal ways by the web app using mysqli_connect and then somehow the same database calls are made in Java inside the android app.

But after some research it appears this may not be the way to do it. What is the way to do this correctly?

EDIT: It was suggested my question was too broad. What I want then is a database of some basic financial information which is stored on the cloud which is then able to be accessed via a web app written in the LAMP stack and via an android app (with java code).

It is a really simple problem but I am not sure what the best practice for such a problem is in android (I come from a web dev background)

  • 写回答

1条回答 默认 最新

  • doumaojin4008 2015-04-13 13:41
    关注

    The standard way to access a database for mobile application is different than a normal web page/application.

    Mobile devices should never run queries in the database; What you do is create a web service that does all the queries in the database and then sends back HTTP responses in xml, JSON format to the mobile device for consumption.

    At the same time you can create a web client that interacts with the web service the same way your mobile app does. This way if you get erroneous data you can debug the web service without having to recompile the code in the mobile app.

    Do a Google search for restful web service

    评论

报告相同问题?

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办