如何将Android连接到数据库服务器

问题描述:

有什么样?我有我的Andr​​oid应用程序,我需要连接到MySQL服务器,我的机器上,什么是最好的方法是什么?

Is there any sample? I have my android application and I need to connect to mysql server on my machine, what is the best way?

我不应该使用JDBC,说明此处

I should not use jdbc, explanation here

  • Best方式来实现客户端< - >服务器16; - >在Android应用程序的数据库架构?

从来就不曾使用的数据库驱动程序通过互联网连接,任何数据库,任何平台,任何客户端,任何地方。这双去移动。数据库驱动程序专为局域网的运行,并不适用于片状/间歇性连接或高延迟。

Never never use a database driver across an Internet connection, for any database, for any platform, for any client, anywhere. That goes double for mobile. Database drivers are designed for LAN operations and are not designed for flaky/intermittent connections or high latency.

和应该去:

DefaultHttpClient httpclient = new DefaultHttpClient(); 

但是,在如何打开一个连接或执行一个简单的SQL语句没有例子。 任何人都可以帮助我吗?

But there is no example in how to open a connection or execute a simple sql statement. anyone could help me?

您应该或者使用Web服务或实现一个RESTful的方式HTTP处理程序和转让。

You should either use web services or implement an HTTP handler and transfer in a RESTful manner.