How to find SQLITE database file version

后端 未结 9 1544
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-02 11:46

I have few sqlite database files. I want to know the database file version i.e if the database was created with sqlite2 or sqlite3 or any other main/sub version (not the sql

9条回答
  •  我在风中等你
    2020-12-02 12:27

    You can get version number of a database file by the Magic Header String:

    • sqlite2 ==> first 48 bytes
    • sqlite3 ==> first 16 bytes

    $ head -c 48 file2.db
    ** This file contains an SQLite 2.1 database **
    
    $ head -c 16 file3.db
    SQLite format 3
    

    The easier way is using the file command:

    $ file file2.db
    file2.db: SQLite 2.x database
    
    $ file file3.db
    file3.db: SQLite 3.x database
    

提交回复
热议问题