I want to use sql-sqlite on a remote database file via TRAMP. According to this website it should be possible, but I cannot get it to work.

I visit the remote directory with Dired and then invoke sql-sqlite:

C-x d /user@host:/directory
M-x sql-sqlite /scp:user@host:/directory/test.db

As expected, this opens an *SQL* buffer with an sqlite prompt. Entering any SQL statements or SQLite commands, however, results in this:

Error: unable to open database "/scp:user@host:/directory/test.db": unable to open database file

Process SQL exited abnormally with code 1

I am using Emacs 25.1 with emacs -Q (the other two versions I have access to, 24.3 and 24.5, behave identically).


After some experimentation and a bit of digging around in the source code, I recognized what went wrong. Running M-x sql-sqlite from the remote Dired buffer starts a remote SQLite process and that process needs to be provided with the absolute path to the database file on the remote machine. So instead of this:

C-x d /user@host:/directory
M-x sql-sqlite RET /scp:user@host:/directory/test.db

I need to to this:

C-x d /user@host:/directory
M-x sql-sqlite RET /directory/test.db

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.