Introduction
SQLite 2 was the version of the SQLite library in use from 2001 until SQLite 3 replaced it in 2004. Its database files have a different layout from SQLite 3 files, and the two are not compatible: SQLite 3 cannot open an SQLite 2 database. They still turn up in old PHP applications, which shipped with SQLite 2 support, and in old program data.
SQLite 2 stored every value as text, while SQLite 3 stores integers, floating point numbers and binary data in their own forms. See all the SQLite versions.
Structure
An SQLite 2 file starts with the text ** This file contains an SQLite 2.1
database **. The file is made of 1,024-byte pages, and tables and indexes are
B-trees of pages, as in SQLite 3, but the page and record layouts differ.
The usual way to convert one is to dump it as SQL with the old sqlite
shell and load the result into SQLite 3:
sqlite old.db .dump | sqlite3 new.db.
Telling SQLite files apart
Read the start of the file. Text beginning ** This file contains an
SQLite means this format. SQLite format 3 followed by a zero byte
means an SQLite 3 database.
Links
Reference
- SQLite Version 3 Overview, on the changes from SQLite 2 and converting old databases