开发者

Connect to a remote database...online database

I've been looking for a week now... I need s开发者_如何学编程ome help connecting to a remote database... I want my app to get data out of the database and update the database... I've tried this but i don't understand it.


Easiest way to connect a Mobile (ANDROID, iPhone, Symbian, WP7, you name it) device to a Data Base is to write a HTTP based proxy for your database.

This is:

ANDROID -> HTTP -> APPLICATION SERVER -> DATABASE

And then the other way around to get results:

DATABASE -> APPLICATION SERVER -> HTTP -> ANDROID

In this scenario, you will write a HTTP based application in your favorite language (PHP, Python, Perl, Java, .NET) and deploy it in your favorite Application Server (Apache, Tomcat, IIS) and, in that application you will publish URLs your Android app will access to send/retrieve data to your database.


I think rather than connect to a database remotely, you want to use REST services to get and post data to your remote database.  

You can create a REST service to wrap your remote database query and return via http, JSON (which I prefer) or XML.

In your android app you can do an http get or post to consume the aforementioned service


  1. Create the database in the server
  2. Write server side program to store and retrieve data
  3. write the android program to access the data using HttpPost class

All the best...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜