Search code examples
sqlitefile-format

Is SQLite 2 database header format different from that of SQLite 3?


I determine whether the file is SQLite database by reading the first 16 bytes of the file (as described in https://www.sqlite.org/fileformat.html). If I've read SQLite format 3, then it's an SQLite database.

I don't have a sample SQLite 2 database so I don't know what header it has, and I couldn't find about it in docs. Anyone knows what the header is?


Solution

  • Although it doesn't explicitly say that the header has changed, I believe that the first 16 bytes would be different, at least in that the 3 (15th byte x'33') would likely not be 3, which is sufficient for SQLite3 to consider the file incompatible.

    What you could do is to obtain a version via History Of SQLite Releases and read the readme at SQLite Source Repository. Compile and perform testing to suit.

    You nay also find File Format Changes in SQLite and additionally SQLite Version 3 Overview of some interest.