0

I have this application using Sqlite db, but suddenly it throws exception saying file is not a database.

I tried .dump the old db to sql file. but inside the sql file still saying the error=>file is not a database.

Is there any other way that I can recover my data? please advice. thanks very much. enter image description here

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
Lancy
  • 595
  • 1
  • 5
  • 10

1 Answers1

0

SQLite, as its name suggests is a lightweight SQL. Technically your database is stored in a file when you use SQLite, see: https://fileinfo.com/extension/sqlite

If your actions were already saved, then hopefully you have a backup that you can load it back from. If your SQLite database is in good state, but you want to generate a sql file, then you can use the dump command, see here: https://www.sqlitetutorial.net/sqlite-dump/

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
  • thanks for answering. the file is database.db, and when i want to load it using the DBbrowser, it showed error message saying that this file is not database. and i have already tried the dump command. the sql file generated also saying file is not a database. – Lancy Apr 21 '21 at 10:45
  • @Lancyliu can you connect to that file from the command-line? – Lajos Arpad Apr 21 '21 at 10:50
  • i only can use sqlite.exe to open it. then when i try any sql command, it will say file is not database. like below. sqlite> .open database.db sqlite> .tables Error: file is not a database sqlite> – Lancy Apr 21 '21 at 10:55
  • @Lancyliu do you have a backup? – Lajos Arpad Apr 21 '21 at 11:00
  • my application will do the back up only once a day in the morning. so the data from morning untill now only inside this database file. @Lajos – Lancy Apr 21 '21 at 11:02
  • so i have to recover this one. do you have any advice? or do you know any tool that i can use to recover my data? – Lancy Apr 21 '21 at 11:06
  • @Lancyliu maybe this will help: https://stackoverflow.com/questions/18259692/how-to-recover-a-corrupt-sqlite3-database/18260642 – Lajos Arpad Apr 21 '21 at 11:15
  • i tried PRAGMA integrity_check already. the same result saying the file is not database. and i tried the .dump command too. also saying this file is not a database. – Lancy Apr 21 '21 at 11:21