Skip to content
Advertisement

Interacting with a .db file from Linux shell

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:

  • isql
  • dbaccess
  • sql
  • SQLite3
  • db.util

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?

Advertisement

Answer

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 ?

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement