开发者

how to place database on remote server using android

I am devloping an android application using java.now i want to place db on remote server,and want to access and upgrade the database.

开发者_如何学CCan anyone help me?


It's at least a challenge to write an android application that would be able to talk with a remote database. AFAIK, there's no jdbc on android.

So your "remote database" needs an additional business layer, some sort of public API that you can use for your CRUD operations. Otherwise you'd have to port jdbc and a jdbc driver for you database for android...

A very simple (and pretty dangerous!) API would simply accept SQL strings (from a trusted source!), forward this SQL to the database and respond with the result set (csv format, for example).


Typically, you won't allow remote connections to your db from an untrusted source.

Instead, think about what operations you want to execute on the database. Then write an interface with all the required methods (addEntry, removeEntry, etc).

On the client side (android), create a class that implements this interface by delegating to the server (HTTP requests or whatsoever).

On the server side, implement the same interface with JDBC access to your db and set up a simple server process that delegates the requests (HTTP or whatever) to this implementation. That's it.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜