#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    86
    Rep Power
    12

    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 [8]: 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...

    Thanks,

    Greg.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    86
    Rep Power
    12

    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...

    Any ideas?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2008
    Posts
    344
    Rep Power
    6
    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.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    86
    Rep Power
    12
    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

    G

    Originally Posted by majlumbo
    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.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    151
    Rep Power
    2
    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/

IMN logo majestic logo threadwatch logo seochat tools logo