开发者

How to select data on website database in android

开发者 https://www.devze.com 2023-03-16 11:18 出处:网络
I have 2 Database which are same, on website and in external storage. I put my database on http://website/folder开发者_StackOverflow社区/database.db or database.sql

I have 2 Database which are same, on website and in external storage. I put my database on http://website/folder开发者_StackOverflow社区/database.db or database.sql I want to take data from my database on website. how to do that?


It is not possible te perform this operation directly. Your website should be able to receive some kind of requests and send responces. Android app should be able to create requests and parse responces. This is the only way.


The better solution I think that is offers a set of REST API to call that execute the query and retrive the results you need and respond with a format like xml, json...

You can offer a set of URL like:

  • http://website/api/getlist -> this respond with an xml that is the list of things you need
  • http://website/api/insert -> sending a json representing your object it will be saved in the db and response with a succesful meessage

and so on... to make this you can use a lot of framework that can help you. I think that the best is spring ( http://www.springsource.org/ ). Look the MVC part and the REST Template is all you need.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号