Android的实用派的SQLite数据库断绝数据库、Android、SQLite

由网友(假面の颓废)分享简介:在我的应用程序,我想送存储在本地的SQLite数据库服务器的SQLSERVER数据库中的数据。是否有任何工具为Android直接发送.db文件和读取服务器上的内容。写作多重插入语句将code非常冗长,将导致主键冲突。请帮忙。谢谢你。In my application i want to send data store...

在我的应用程序,我想送存储在本地的SQLite数据库服务器的SQLSERVER数据库中的数据。是否有任何工具为Android直接发送.db文件和读取服务器上的内容。写作多重插入语句将code非常冗长,将导致主键冲突。请帮忙。谢谢你。

In my application i want to send data stored in the local sqlite database to server's sqlserver database. Is there any utility for android to directly send the .db file and read the content in the server. Writing multiple insert statements will make code very lengthy and will cause in the primary key violation. Please help. Thanks.

推荐答案

在创建您指定的数据库名称的数据库(如 products.db )。如果你的应用程序包的名字是com.example.yourapplicationpackage,您可以使用路径访问文件: /data/data/com.example.yourapplicationpackage/databases/products.db

When you create the database you are specifying the database name (for instance products.db). If your application package name is com.example.yourapplicationpackage, you can access the file using the path: /data/data/com.example.yourapplicationpackage/databases/products.db

然后,您可以发送该文件就像任何其他文件到您的服务器(使用POST请求)。在服务器端,你需要的类来读取一个SQLite 3数据库文件,这不应该是很难找到的。

Then you can send that file just like any other file to your server (use a POST request). On the server side, you need classes to read a SQLite 3 database file, this should not be hard to find.

阅读全文

相关推荐

最新文章