SQLite User Forum

New to SQLite3- Dev = Windows, Host = Linux
Login

New to SQLite3- Dev = Windows, Host = Linux

(1) By Kevinh (kevinh21gmail) on 2022-09-11 19:14:19 [link] [source]

Developed PHP 8.x with SQLite3 on Windows11. Uploaded to Linux Host and get "database disk image is malformed" error.

Do I need to create a Linux version of the SQLite3 database?
If yes, are online tools for Linux. If not, any ideas? Thanks.

(2) By Simon Slavin (slavin) on 2022-09-11 20:26:44 in reply to 1 [link] [source]

Database format is identical across platforms. Everything can use everything, doesn't matter if 32-bit or 64-bit, little-endian or big-endian, different OS or file system.

You have probably tripped up on some automatic format conversion thing. Something automatically changing Windows returns to Unix returns ? Automatically truncating the file at 0x00 ? Did you check the file length to see it didn't change ?

There are some caveats to do with the version of SQLite you're using, and whether you use any recently-introduced facilities. So, which versions of SQLite are you running on each platform ? If you don't know, execute

SELECT sqlite_version();

on both platforms and tell us what you get back.

Also tell us whether you're using any recently-introduced features. Basic facilities like tables, indexes and views are not a problem. But are you using tables without ROW IDs ? Generated columns ? If you used these you would know about it.

(3) By Simon Slavin (slavin) on 2022-09-11 20:31:11 in reply to 1 [link] [source]

Oh yeah

https://www.sqlite.com/download.html

Find "Precompiled Binaries for Linux".

(4) By Donald Griggs (dfgriggs) on 2022-09-11 20:47:12 in reply to 1 [source]

Hi, Kevin,

Sqlite goes takes care that you can transfer a database between lots of platforms with no conversions required.

I might check:

  1. Was the Windows database run with a newer version of sqlite than what is used on Linux? (and some new feature was used that was not available on the older version?) Check version using: select sqlite_version();
  2. Was there perhaps an active WAL file for the original database that was not included? (https://www.sqlite.org/tempfiles.html)
  3. Do the file sizes match precisely? Can you get a hash of each?
  4. Does the windows version of the database pass a check using: "select * from pragma_integrity_check();" ? If you're sure the sqlite versions are compatible (point #1) does the Linux version fail this check?

If none of this is helpful, this forum has folks with much more knowledge than I who can assist.