How to connect to an existing database with sqlite3 3.6.20

If you have the later versions of sqlite, then using the command line client sqlite3 to open a .db file is easy, and is available on the 1st page of a web search, which is that you get into the commandline with sqlite3 command and then type “.open </path/to/filename>” and connect to a specific exisiting database.

But in version 3.6.20 – when you do a .help – you will notice that there is no .open command. And when you type  “.open </path/to/filename>” , sqlite3 will politely respond with the message – ‘Error: unknown command or invalid arguments: “open”. Enter “.help” for help’

The solution is to pass the .db file name as a command line argument – i.e. you do a ‘sqlite3 </path/to/filename.db>’ to connect to an existing database.

This is a version specific post. Other environment details – CentOS 6.4 (final) and SQLite was the version bundled with Python 2.6.6 .


About vatsalad

Hi, I'm Vatsala
This entry was posted in How To... and tagged , . Bookmark the permalink.