简体   繁体   English

从Android应用程序导出Sqlite数据

[英]Exporting Sqlite data from an Android Application

My Android application stores all user data in a Sqlite database. 我的Android应用程序将所有用户数据存储在Sqlite数据库中。 What are my options to backup/export/import/copy this data? 我有哪些备份/导出/导入/复制此数据的选项? I know I can easily copy the database to the SD card. 我知道我可以轻松地将数据库复制到SD卡。 I would also like to send the data to a network server. 我还想将数据发送到网络服务器。 Are there any packages/classes available to facilitate getting sqlite information to/from a network server? 是否有可用的软件包/类来促进从网络服务器获取sqlite信息? Thanks for the help... 谢谢您的帮助...

在那里看到我的答案: Android Utility将sqlite db发送到服务器

SQLite data base files are just flat files, that I am pretty sure is platform portable. SQLite数据库文件只是平面文件,我敢肯定它是平台可移植的。 So the only issue about getting data two or from a network is exactly equal to your ability to access the file itself. 因此,关于从两个或两个网络中获取数据的唯一问题与您访问文件本身的能力完全相同。 The point being that you can run the SQLite demo program itself on whatever platform you like to access to data directly, or share the file over a network and use the SQLite C library directly on it, or copy the file then use the local copy as you like. 关键是您可以在想要直接访问数据的任何平台上运行SQLite演示程序本身,或者通过网络共享文件并直接在其上使用SQLite C库,或者复制文件,然后将本地副本用作你喜欢。

Your best bet is to store the db on the external storage. 最好的选择是将数据库存储在外部存储中。 If you use the built in (automagic) databases you won't be able to directly access the file. 如果您使用内置(自动)数据库,则将无法直接访问该文件。 Once it's on the SDCard (or future storage options) you can just upload the file to the server using one of the standard HTTP libraries. 将其放在SDCard(或将来的存储选项)上后,您可以使用标准HTTP库之一将文件上传到服务器。

One of the apps I've been working on does something similar, but in reverse. 我一直在开发的应用程序之一执行的操作类似,但相反。 We're downloading a SQLite3 DB from a server then storing it to the external storage (SDCard). 我们正在从服务器下载SQLite3数据库,然后将其存储到外部存储(SDCard)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM