esp_arduino_sqlite3_lib icon indicating copy to clipboard operation
esp_arduino_sqlite3_lib copied to clipboard

SQL command cannot be executed - Error: File is encrypted or is not a database.

Open ts-abc opened this issue 6 years ago • 16 comments

I first tried the sdfat example, then the console_spiffs, as last the db_small example. All of them show the same Error, "file is encrypted or is not a database".

Monitor output in last db_small: Opened database successfully Failed to fetch data: file is encrypted or is not a database<br><br><a href='/'>back</a>

What can I try, better how do I solve this problem. Databases are definitely in order, all can be opened from the SD card and queried.

ts-abc avatar Apr 29 '19 02:04 ts-abc

It seems to be because of changes in the dependent library SdFat. It works fine if I downgrade it to 1.0.7. I intend to remove the dependency by using the standard SD library in future. Also don't forget to change the stack size to 6144 in cont.h

siara-cc avatar Apr 29 '19 05:04 siara-cc

Ji, whenever I download any db from the github (or) esp8266 sqlite3; In the properties of the db shows the following message as This file came from another computer and might be blocked to help protect this computer.

"May be that be the reason for can't open the database"

kabilramar avatar Apr 29 '19 12:04 kabilramar

It seems to be because of changes in the dependent library SdFat. It works fine if I downgrade it to 1.0.7. I intend to remove the dependency by using the standard SD library in future. Also don't forget to change the stack size to 6144 in cont.h

Oh gosh, correct, on the point, the downgrading to 1.0.7 fixes the problem completely. Yeah I had tested the cont.h before, from 7 or was it 8 bytes the ESP doesn't start anymore.

Yes the removing dependencies is a good idea. The only question is, it's possible without SD library. I don't know the details yet, I'm only working rigth now 3 weeks with the ESP's and co. But maybe it's possible to get the opened file handle, so every library could be used to access the file system.

ts-abc avatar Apr 29 '19 21:04 ts-abc

@kabilramar, I really don't understand what you want to say or ask, but is this the return error message of the SQL command or simply from the system's downloader. You should describing your problem in more detail and exclude any errors that might be caused by other thinks. First check if the SD card can be read or files can be opened.

ts-abc avatar Apr 29 '19 21:04 ts-abc

Yes man I could read or write text file in sdcard interfacing nodemcu. But when I tried the sdfat program it says Unable to open Database what is the reason??? I changed by downgrading the sdfat library to 1.0.7.

kabilramar avatar Apr 30 '19 07:04 kabilramar

@ts-abc and I am using a Catalex Micro Crad Adapter instead of wemos Micro Shield

kabilramar avatar Apr 30 '19 07:04 kabilramar

@siara-cc is it necessary to use only Wemos sd shield and not catalex micro adapter

kabilramar avatar Apr 30 '19 08:04 kabilramar

@siara-cc I read you ESP32 in Hackster io It was so nice. This is the connection for ESP32 which i have referred in Hackster.io SD Card | ESP32

  • DAT2 (1) -
  • DAT3 (2) SS (D5)
  • CMD (3) MOSI (D23)
  • VDD (4) 3.3V
  • CLK (5) SCK (D19)
  • VSS (6) GND
  • DAT0 (7) MISO (D18)
  • DAT1 (8) -

Can you please mention the wiring connection for esp8266 and micro SD card shield

Auroratechive avatar Apr 30 '19 12:04 Auroratechive

Can I change mount(Sd0/Ss) to mount (sd0/8 )

raghuram-bala avatar Apr 30 '19 15:04 raghuram-bala

If you have free time please publish it as an video it will be more useful for easy understanding

raghuram-bala avatar Apr 30 '19 15:04 raghuram-bala

@kabilramar I am not sure about catalex adapter @Auroratechive Please see the picture on README page. The connection is shown in the adapter itself.

Can I change mount(Sd0/Ss) to mount (sd0/8 )

@raghuram-bala please see the example sdfat to find out how the SS pin can be changed

If you have free time please publish it as an video it will be more useful for easy understanding

I may be a good idea to make a video. Presently I am unable to spare much time for this.

siara-cc avatar Apr 30 '19 16:04 siara-cc

I would like to point out that given the limited RAM on ESP8266 and even ESP32, it would be a challenge to get a project working, even if you manage to solve the connection issues. It was difficult to get the examples working, especially on esp8266. Only pagesize 512 would work that too with without row id option and good index design. Insert frequency and Memory fragmentation is to be considered. Now there is no doubt that they are working on the WeMos board with SdFat 1.0.7, but on any other board and any other use case, I may not be able to help much remotely and you are on your own.

siara-cc avatar Apr 30 '19 16:04 siara-cc

@ arun Thank you arun

raghuram-bala avatar May 01 '19 02:05 raghuram-bala

@ arun it means

D8 of the Wemos Mini Shield to be connected to SS pin on the SD Card Shield D7 of the Wemos Mini Shield to be connected to MOSI pin on the SD Card Shield D6 of the Wemos Mini Shield to be connected to MISO pin on the SD Card Shield D5 of the Wemos Mini Shield to be connected to CLK pin on the SD Card Shield

"Is it right sir"

kabilramar avatar May 01 '19 02:05 kabilramar

@ arun Where should the following line should be given ?? On cont.h or some other .h files

Please use a page size of 512 using the commands PRAGMA page_size=512; VACUUM;

raghuram-bala avatar May 01 '19 03:05 raghuram-bala

The file gets corrupted sometimes. I assume it is because of power disconnection when write happens. I am not sure.

I suggest copy the file again, try the example sketch first using the clone of the present repo and then modify from there.

siara-cc avatar Sep 15 '19 05:09 siara-cc