# Unable to open sqlite database with database browser but works fine in app

**URL:** <https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688>\
**Category:** Databases\
**Created:** [May 29, 2018, 3:52am UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688 "2018-05-29T03:52:46Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philip\_Cumpston](https://forum.xojo.com/user_avatar/forum.xojo.com/philip_cumpston/32/621_2.png) [@Philip\_Cumpston](https://forum.xojo.com/u/Philip_Cumpston)\
**Post date:** [May 29, 2018, 3:52am UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/1 "2018-05-29T03:52:46Z")

</div>

I am getting HH.sqlite is damaged and cant be opened. You should move it to the Trash." when I try to browse the database with a number of different browsers, including Tadpole, DB Browser lite, sqlite studio and Base. However, my app still reads and writes to it happily.  
Can anyone suggest why this might be so?  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![Greg\_O\_Lone](https://forum.xojo.com/user_avatar/forum.xojo.com/greg_o_lone/32/49_2.png) [@Greg\_O\_Lone](https://forum.xojo.com/u/Greg_O_Lone)\
**Post date:** [May 29, 2018, 4:14am UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/2 "2018-05-29T04:14:36Z")

</div>

Are you using encryption?

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [May 29, 2018, 5:09am UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/3 "2018-05-29T05:09:44Z")

</div>

Tadpole will report this if the file is either not a database or is in fact encrypted, so if your app reads it, I’d check your code and I will bet you will find an included encryption key somewhere… One other thing are you sure its an SQLite database, and not mySQL, or some other database engine???, an SQLite engine will report this same thing on other database formats it can’t read

---

<div class="post-metadata">

**Author:** ![Philip\_Cumpston](https://forum.xojo.com/user_avatar/forum.xojo.com/philip_cumpston/32/621_2.png) [@Philip\_Cumpston](https://forum.xojo.com/u/Philip_Cumpston)\
**Post date:** [May 29, 2018, 11:52pm UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/4 "2018-05-29T23:52:17Z")

</div>

Thanks to Greg and Dave.  
It is a SQLite database, not encrypted (although thinking about whether I should do that for release)  
Funny thing is that a previous copy from a few days ago can be read easily. I am confused as to why my application can read and display values, but the various sqlite browsers I have tried are reporting an error.

Will recheck all the code.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [May 29, 2018, 11:55pm UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/5 "2018-05-29T23:55:17Z")

</div>

If it is SQLite and it is NOT encyrpted than Tadpole or any of the others you mentioned should have no trouble/

One way to check… if you can, open the DB file with a hex editor.  
the first 16 bytes will be  
“SQLite format 3.” where the . is 0x00  
this is for a Non-encrypted database, and encrypted one will be “gibberish”

---

<div class="post-metadata">

**Author:** ![Philip\_Cumpston](https://forum.xojo.com/user_avatar/forum.xojo.com/philip_cumpston/32/621_2.png) [@Philip\_Cumpston](https://forum.xojo.com/u/Philip_Cumpston)\
**Post date:** [May 29, 2018, 11:59pm UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/6 "2018-05-29T23:59:35Z")

</div>

Thanks Dave. Downloaded and ran iHex for Mac. Confirms it is Sqlite format 3.  
Then I had a thought. Maybe the SQLite viewers (including Tadpole) can’t read files when they are located in \users\pcumpston  
library\containers\…\Data\Documents\xx.sqlite?  
So I copied it to a standard readable \Documents subdirectory and guess what?  
I can read it and modify it with Tadpole and other utilities, then copy it back for ongoing use.

Not only that, but I can now read the same file in the original location. (Scratching head in puzzled manner)

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [May 30, 2018, 12:04am UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/7 "2018-05-30T00:04:59Z")

</div>

I use UltraEdit, but its not free…I’ve used it as a source code editor for more years than I care to think about

but I just tried, and if it is not encyrpted you should be able to use TextEdit (on Mac) or the Window equiv… and see that same phrase

---

<div class="post-metadata">

**Author:** ![Philip\_Cumpston](https://forum.xojo.com/user_avatar/forum.xojo.com/philip_cumpston/32/621_2.png) [@Philip\_Cumpston](https://forum.xojo.com/u/Philip_Cumpston)\
**Post date:** [May 30, 2018, 12:13am UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/8 "2018-05-30T00:13:10Z")

</div>

TextEdit gives the same error in that location. Must be something to do with the operating system. File permissions are identical.  
Thanks again for your help

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [May 30, 2018, 5:57am UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/9 "2018-05-30T05:57:13Z")

</div>

it seems a sandboxing problem ?

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [May 30, 2018, 1:49pm UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/10 "2018-05-30T13:49:49Z")

</div>

> [@389768:@Jean-Yves Pochez](#):
>
> it seems a sandboxing problem ?

Doubtful, as Tadpole is not a sandboxed app… SQLite does create journal files that seem to violate the sandbox requirements, which is why Tadpole didn’t appear in the AppStore

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 7:13pm UTC](https://forum.xojo.com/t/unable-to-open-sqlite-database-with-database-browser-but-works-fine-in-app/43688/11 "2020-10-29T19:13:57Z")

</div>


