July 17th, 2012, 07:38 AM
Please help.. Read only error on client machine install?
Hi, has anyone had this? My app when installed on a clients machine won't write to it's sqlite database.
I get the following error:
Error executing SQL statement.
Error : Attempt to write a readonly database.
"Update collections set col_name = "Default-You can rename this",coltype_id = "3224" where col_id = "1"": attempt to write a readonly database.
I've checked the database properties in explorer and it is not "read" only so I really am not sure what to do?
The install file was created in InnoScript and it works perfectly when tested on my machine but not when I test it on another laptop.
The SQLite3.dll file is included in the install script by the way...
July 17th, 2012, 08:46 AM
It's a permissions error but how to fix it...
I found the problem but don't know how to get around it...
The database file is installed with Read & Execute & Read permissions under Users.
Try as I may I can't get the Inno setup to install with "full control" even though I'm setting the permissions in InnoSetup to do this...
Its as though Win7 simply overrides this setting....
I'm testing on a Vanilla laptop with Win7 installed...
July 17th, 2012, 09:11 AM
Which directory is SQLite working from? Win7 UAC will block attempts to write to certain directories on your hard drive.
Older versions of Delphi made a sub-directory of Program Files the location of your development directory, and many programmers put all there utility files (files they read and write to in the operation of their program) in the same directory. With Vista and above, the program directory is no longer a valid place to put files that need to be written to.
You can get around this by changing the location that SQLite works in. I haven't worked with the database before, but I'm sure there has to be a preferred location for the database to operate from.
July 17th, 2012, 10:20 AM
Yup! The database was working from the Program Directory... I'm busy moving it to the %appdirectory% and I think all will be solved :P
Originally Posted by majlumbo
July 18th, 2012, 05:32 AM
Looks like your problem is caused by UAC protecting the folder where you stored the sqlite database file. You should consider putting it in user's application data or "all users" application data, to make it writeable by the current user.
I wrote a tutorial addressing the use of the special folders to avoid exactly your problem while still harnessing UAC protection power. Read it here: http://forum.codecall.net/topic/60120-using-special-folders-to-comply-with-uac-enabled-windows-with-delphi-code/