Change SQLite database mode to read-write

前端 未结 14 569
盖世英雄少女心
盖世英雄少女心 2020-12-13 01:35

How can I change an SQLite database from read-only to read-write?

When I executed the update statement, I always got:

SQL error: attempt to wr

相关标签:
14条回答
  • 2020-12-13 02:26

    On Linux, give read/write permissions to the entire folder containing the database file.

    Also, SELinux might be blocking the write. You need to set the correct permissions.

    In my SELinux Management GUI (on Fedora 19), I checked the box on the line labelled httpd_unified (Unify HTTPD handling of all content files), and I was good to go.

    0 讨论(0)
  • 2020-12-13 02:26

    In the project path Terminal django_project#

    sudo chown django:django *
    
    0 讨论(0)
  • 2020-12-13 02:33

    I had this problem today, too.

    It was caused by ActiveSync on Windows Mobile - the folder I was working in was synced so the AS process grabbed the DB file from time to time causing this error.

    0 讨论(0)
  • 2020-12-13 02:33

    To share personal experience I encountered with this error that eventually fix both. Might not necessarily be related to your issue but it appears this error is so generic that it can be attributed to gazillion things.

    1. Database instance open in another application. My DB appeared to have been in a "locked" state so it transition to read only mode. I was able to track it down by stopping the a 2nd instance of the application sharing the DB.

    2. Directory tree permission - please be sure to ensure user account has permission not just at the file level but at the entire upper directory level all the way to / level.

    Thanks

    0 讨论(0)
  • 2020-12-13 02:34

    (this error message is typically misleading, and is usually a general permissions error)

    On Windows

    • If you're issuing SQL directly against the database, make sure whatever application you're using to run the SQL is running as administrator
    • If an application is attempting the update, the account that it uses to access the database may need permissions on the folder containing your database file. For example, if IIS is accessing the database, the IUSR and IIS_IUSRS may both need appropriate permissions (you can try this by temporarily giving these accounts full control over the folder, checking if this works, then tying down the permissions as appropriate)
    0 讨论(0)
  • 2020-12-13 02:36

    This error usually happens when your database is accessed by one application already, and you're trying to access it with another application.

    0 讨论(0)
提交回复
热议问题