SQLite: Unable to open databse file

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

SQLite: Unable to open databse file

Post by MaxV » Thu Apr 09, 2015 11:28 am

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#####
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: SQLite: Unable to open databse file

Post by Klaus » Thu Apr 09, 2015 12:23 pm

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

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: SQLite: Unable to open databse file

Post by MaxV » Thu Apr 09, 2015 3:06 pm

Hi Klaus,
revopendatabase works with relative pathnames.
thank you for your HELP
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply