Android的 - 访问在线数据库SQLite的在线、数据库、Android、SQLite

由网友(有一种安静,叫做老师来了)分享简介:我需要打开,读取和Android应用程序。照片我知道网址,用户名和密码,将项目插入一个在线SQLite数据库。在JavaSE的我会做到以下几点:I need to open, read and insert items into an online SQLite database from an Android a...

我需要打开,读取和Android应用程序。照片我知道网址,用户名和密码,将项目插入一个在线SQLite数据库。在JavaSE的我会做到以下几点:

I need to open, read and insert items into an online SQLite database from an Android app. I know url, username and password. In JavaSE i would do the following:

Class.forName("com.mysql.jdbc.Driver");
Connection dbConnection = DriverManager.getConnection(URL, USER, PASSWORD);

我看,我不能这样做在Android中,因为没有一个JDBC驱动程序(有一个SQLite.JDBCDriver,但它不记录,不推荐)。 因此,这是最简单的方法是什么?我问谷歌,但它看起来像他要么不知道。

I read that I can't do this in Android because there is not a JDBC Driver (there is a "SQLite.JDBCDriver" but it is not documented and not recommended). So which is the easiest way? I asked to Google but it looks like he either doesn't know.

推荐答案

您应该通过一个中介暴露你的数据源是这样,如Web服务,至少有以下原因:

You should expose your datasource like this via an intermediary such as a Web Service for at least the following reasons:

有人直接访问您的数据源,可以读取,操纵或破坏数据 抽象;可以控制其中的数据被发送的方式,它是如何重新presented。如果数据库表/对象的改变,你只需要更改Web服务,而不是强制进行更新(在某些情况下) 在JSON交互具有很好的支持在Android开箱即用,而JDBC是不是(为previously记录的原因)

我敢肯定有很多的原因比较多,但以上是最prevalent在我的脑海里。

I'm sure there are plenty of more reasons, but the above are the most prevalent in my mind.

阅读全文

相关推荐

最新文章