问题

我已经从android设备导入了一个.db文件,希望使用Libreoffice Base或类似的打开它。

如何实现这个目标?

答案1安装SQLite浏览器,它位于存储库中,(资源)Firefox 的扩展:SQLite Manager

答案2

这是一个sqlite数据库,因此,只需用sqlite CSV命令打开它,然后导出它,运行以下命令:sqlite3 bookCatalogueDbExport.db

你应该看到如下所示的提示:sqlite>

如果得到"command not found"的错误,你需要安装SQLite3sudo apt-get install sqlite3

通过列出表来验证SQLite是否可以读取数据库:sqlite> .tables

books

只要告诉sqlite 3你想要的格式,并让它输出所有数据:sqlite> .mode list

sqlite> .separator , -- Comma-Separated (aka CSV)

sqlite> .output books.csv -- Where to save the file

sqlite> select * from books; -- Replace 'books' with the actual table name

sqlite> .exit

现在应该有一个books.csv的文件,你可以直接使用LibreOffice Calc打开。

注意SQLite数据库可以有多个表,如果是这种情况,你将希望将每个表输出为自己的文件,那就不是键入'.exit',你可以这样继续:sqlite> .output some_other_table.csv -- Give it a different name

sqlite> select * from some_other_table; -- Replace 'books' with the actual table name

sqlite> .exit -- When done exporting all the tables

答案3

数据库文件的类型是什么?.db扩展不特定于某种类型的数据库,不过,由于它来自Android,我猜它是一个sqlite数据库。

答案4

Adminer是可以在Web浏览器中查看SQLite DB文件的另一种选择:http://www.adminer.org

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐