SQLite Forum

No ".open" option in version 3.7.17 2013-05-20
Login

No ".open" option in version 3.7.17 2013-05-20

(1) By anonymous on 2021-10-26 09:12:15 [link] [source]

Hi, I am trying to open a db in my server directory but the command ".open" is not recognized. When I type ".help", the ".open" is not listed... How can I open then the db? Thanks!

(2) By Stephan Beal (stephan) on 2021-10-26 10:00:45 in reply to 1 [link] [source]

No ".open" option in version 3.7.17 2013-05-20

...

How can I open then the db?

You pass the db name to sqlite3:

$ sqlite3 /path/to/the/db.file

noting that 3.7 is now more than 8 years old and will be missing all sorts of more current features.

(3) By Richard Hipp (drh) on 2021-10-26 10:21:25 in reply to 2 [link] [source]

noting that 3.7 is now more than 8 years old and will be missing all sorts of more current features.

Yeah. A simpler solution would be to download and use the latest 3.36.0 CLI.

(4) By anonymous on 2021-10-26 11:00:36 in reply to 2 [link] [source]

Thanks, I did so and then typed ".tables" and nothing appeared... does this mean, does the db is not an sqlite db? (because I now for certain, that the db is not empty)

(5) By Bill Wade (billwade) on 2021-10-26 12:20:53 in reply to 4 [link] [source]

The first several bytes in an sqlite db are ascii "SQLite format 3" (without the quotes). There are exceptions to that with some VFS implementations, but for those you'd have to do something special with sqlite3.exe anyway.

If you open the file with a binary editor, you can check for that string, or if you have unix utilities:

strings myfile.db | head

to see if that string shows up.

(6) By anonymous on 2021-10-26 12:38:35 in reply to 5 [link] [source]

I did so and can read text/words does make sense, but there was no "SQLite format 3" text on the head...

Does this mean that 1) the db is an sqlite db (why could I not get any .table nor .schema? it says file is not a database of it is encrypted 2) the db is not an sqlite db but its encoding could be read with "strings myfile.db | head"?

I also run "strings myfile.db more" and seen
  1. What would you recommend me to get the schema of this db and manage to read it?
  2. Can I dump somehow these strings to a kind of csv textfile?

(7) By Bill Wade (billwade) on 2021-10-26 13:20:26 in reply to 6 [link] [source]

That test tells you it is not a typical sqlite3 database file. So you've eliminated one possibility out of many (and mostly the only one this forum discusses).

Since you have unix utilities, you might try the "file" command, which (according to its man page) determines file types.

If I rename a Microsoft Access .mdb file to abc.def I get

$ file abc.def
abc.def: Microsoft Access Database

so it sometimes works.

(8) By anonymous on 2021-10-26 14:39:41 in reply to 7 [link] [source]

Hi, thanks. It said it is of type "data"

(9) By Larry Brasfield (larrybr) on 2021-10-26 14:50:55 in reply to 8 [source]

In other words, it is of type "Unrecognized". The "file" utility has known of SQLite databases for awhile now. But you need not rely on it. The first 16 bytes of a SQLite3 database are as stated earlier in this thread. What does 'od -c your.db | head' say?

(10) By anonymous on 2021-10-26 15:20:13 in reply to 9 [link] [source]

0 0 0 0 0 0 0 0 M A S T E R M A S T E R M A S T E R M A S T E R M A S T E R M A S T E R M A S T E R M A S T E R 0 357 R 0 0 0 0 0 0 0 0 0 0 0 0 0 0 357 R 0 0 0 0 0 ...

(11) By Larry Brasfield (larrybr) on 2021-10-26 15:30:06 in reply to 10 [link] [source]

You do not need "file" or me to tell you that is not the beginning of a SQLite3 database file.

(12) By anonymous on 2021-10-26 15:40:39 in reply to 11 [link] [source]

Thanks... I will copy the db, install several database engines and try to import the db into those engines to see which one recognizes it... thanks a lot for your time and patience :-)