Page 1 of 1

SQLite: Unable to open databse file

Posted: Thu Apr 09, 2015 11:28 am
by MaxV
Today I have a strange error with my new app.
It works on IDE, but I get this error on Android:
Database Error: Unable to open database file
I checked that the file is correct and not corrupted, my app has SQLite library and also write permissions... :?:
This is my code:
########CODE#######
on preOpenStack
if the environment is "mobile" then
#android
set the defaultFolder to specialFolderPath("engine")
answer the files
else
#PC
set itemDel to "/"
set the defaultFolder to item 1 to -2 of (the effective fileName of this stack)
end if
end preOpenStack

on opencard
put revOpenDatabase("sqlite", "./parole.sqlite") into connID
end opencard
#####END OF CODE#####

Re: SQLite: Unable to open databse file

Posted: Thu Apr 09, 2015 12:23 pm
by Klaus
Hi Max,

you do not have write permissions in the ENGINE folder, even opening a SQL file is prohibited there.
You need to copy the SQLite file to the users documents folder first.


Best

Klaus

P.S.
I 'm not sure if revopendatabase works with relative pathnames?
Why not provide the absolute pathname, instead of messing around with the default folder? :D

Re: SQLite: Unable to open databse file

Posted: Thu Apr 09, 2015 3:06 pm
by MaxV
Hi Klaus,
revopendatabase works with relative pathnames.
thank you for your HELP