Android Utility to send sqlite db to server

百般思念 提交于 2019-12-29 06:32:02

问题


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.


回答1:


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

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.



来源:https://stackoverflow.com/questions/6042453/android-utility-to-send-sqlite-db-to-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!