Android实用程序将sqlite db发送到服务器 [英] Android Utility to send sqlite db to server

查看:489
本文介绍了Android实用程序将sqlite db发送到服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我想将存储在本地sqlite数据库中的数据发送到服务器的sqlserver数据库。有没有任何实用程序为android直接发送.db文件和读取服务器中的内容。编写多个insert语句将使代码非常冗长,并将导致主键冲突。请帮忙。

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.

推荐答案

创建数据库时,您指定数据库名称(例如 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.

这篇关于Android实用程序将sqlite db发送到服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆