1

So far all the examples of converting a SQLite2 database to SQLite3 or MySQL all answers assume that the person has access on their computer to the tools needed to do this conversion or access to specific folders on a webserver host.

Can someone actually give a working answer that will allow someone who is using a web host on a shared server to convert or export the contents of an SQLite2 database to a SQLite3 or MySQL database please?

I have a webserver on my PC and PHP but the version of PHP that I have does not support SQLite2 so I am stuck because you have to use this particular version of PHP with the webserver, I can't just swap it out for another version, my options appear to be with doing the conversion on the webserver.

Help in solving this issue would be appreciated.

Mark Giblin
  • 1,086
  • 2
  • 13
  • 20
  • Do you mean you have to migrate a sqlite2 database to a sqlite3? – Stefano Sanfilippo Feb 01 '14 at 11:37
  • Yes, PHP above a particular version of PHP no longer supports SQLite2 databases. – Mark Giblin Feb 01 '14 at 13:06
  • CaN you download the SQLite2 DB? Or are you forced to do this online? – Stefano Sanfilippo Feb 01 '14 at 13:34
  • I have (and can download the DB as needed) the problem is that the version of PHP I have does not support SQLite2 anymore. I do have indirect access to upload a shell script to the server if that helps, I don't however have any direct way of executing it other than setting up a cronjob which is only possible through the cPannel that the web host uses. – Mark Giblin Feb 01 '14 at 13:46

1 Answers1

3

You don't need PHP to convert a database. Download:

  1. SQLite 2.8 from https://www.sqlite.org/sqlite-2_8_17.zip
  2. SQLite 3.2 from https://www.sqlite.org/2013/sqlite-shell-win32-x86-3080200.zip

Decompress both in a folder. Assuming your DB file is called old.db, put it in the same folder as the two executables, navigate to the folder with cmd.exe and run the following command:

sqlite old.db .dump | sqlite3 new.db

as recommended in the SQLite 3.x announcement. new.db will contain the same data in 3.x format.

Stefano Sanfilippo
  • 32,265
  • 7
  • 79
  • 80