java - 如何通过连接到远程位置来更新 Android 数据库

标签 java android database sqlite

我希望连接到 URL 并下载文件 (.db),如果它是更高版本,则更新应用程序上的数据库。例如当前使用Database1.db,此在线数据库是Database2.db。但是我不太确定该怎么做。我正在使用 sqlite。

谢谢

最佳答案

从服务器端:

Instead of uploading database from url you can post xml or json data which will give details bout database version and sql query

来自 Android 程序

connect to url get the data check for the version if version from url is higher than that of existing one then execute the sql query that you got to create database and take backup of your data

场景

Lets consider one scenario you have some data in a table named y in old database. but the new database which you are downloading doesn't have that y table but it has some new table then what do you want to perform with that data. Do you want to discard or store if store and use then to where you want to store.

关于java - 如何通过连接到远程位置来更新 Android 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8679154/

相关文章:

sql-server - 我在哪里可以找到有关如何编写数据透视 SQL 查询的指南或示例?

java - 异常 : org. postgresql.util.PSQLException:错误: "call"处或附近的语法错误

java - java.beans.Beans 类无法使用修饰符 ""访问 Perosn.PersonDAO 类的成员?

java - 将 Apache Commons HttpClient 日志调整为 Dropwizard

android - 如何磨练我的安卓开发技能?

java - 使用 IBM MobileFirst Platform Foundation 生成的 Android 应用程序中的单元测试 Java 代码

Android Studio 与 Protobuf 集成

java - 操作布局上的所有按钮

database - 在 Slick 中自动生成 UUID

ruby-on-rails - 如何使用 Ruby on Rails 获取硬件信息?