I recently installed minidlna, a lightweight UPnP server, on my Raspberry Pi. Since this lacks the web interface of other programs such as Mediatomb, I thought it could be an interesting project for me to write one.
I believe minidlna stores library information in a single file named "files.db".
EDIT: I was advised to check the output of file files.db
- this was as follows:
files.db: SQLite 3.x database, user version 8
However, I can't find a program that lets me interact with .db files from the shell. I've seen the following programs recommended:
In the first four cases, sudo apt-get install
cannot find the programs.
sudo apt-get install db.util
appears to install, but partway through installation, yields the following messages:
Processing triggers for man-db ...
Setting up gcj-4.7-base (4.7.1-1) ...
Setting up libgcj-common (1:4.6.3-7) ...
Setting up libgcj13 (4.7.1-1) ...
Setting up libgcj13-awt (4.7.1-1) ...
Setting up gcj-4.7-jre-headless (4.7.1-1) ...
Illegal instruction
ERROR: gcj-dbtool did fail; known problem on armv6l
Setting up gcj-4.7-jre (4.7.1-1) ...
Setting up gcj-4.7-jre-lib (4.7.1-1) ...
Setting up gcj-jre-headless (4:4.7.1-1) ...
Setting up gcj-jre (4:4.7.1-1) ...
Setting up libservlet2.5-java (6.0.35-5) ...
Setting up libhsqldb-java (1.8.0.10-11) ...
Setting up hsqldb-utils (1.8.0.10-11) ...
Thereafter, which db-util
, which db.util
, and which dbutil
do not yield any results.
Is db.util the correct program to be installing to interact with .db files? If so, how can I fix the reported error with gcj-dbtool? If not, could someone recommend a better program?
If you are using Linux or a Mac, open a terminal window instead a command prompt. Open a command prompt (cmd.exe) and 'cd' to the folder location of the SQL_SAFI. sqlite database file. run the command 'sqlite3' This should open the SQLite shell and present a screen similar to that below.
In Windows Explorer, navigate to the drive or folder containing the Access database file you want to open and double-click the database. Access starts and the database is opened.
First open the SQLite database from File > Open Database… Now select your SQLite database file and click on Open. Your database should be opened. Now you can click on File > Export and then select either Database to SQL file… or Table(s) as CSV file… or Table(s) to JSON… to export the database to your desired format.
A DB file is a database-related file. Most can't be opened manually but are instead used by various programs automatically. Some can be converted to JPG or CSV.
You could also use python, since it should already be on your Raspberry Pi and comes with batteries / sqlite3 included.
python -c "import sqlite3; print(sqlite3.connect('example.db').cursor().execute('SELECT * FROM stocks ORDER BY price').fetchall())"
You will have to install a package named 'sqlite' or 'sqlite3'.
Then you will be able to interact with your .db file using
$ sqlite3 files.db
> SELECT blah FROM your_table WHERE ......
In your post you mention 'SQLite3', the package name should have no caps letters.
Did you run an apt-cache search sqlite
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With