Change SQLite database mode to read-write

前端 未结 14 570
盖世英雄少女心
盖世英雄少女心 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:39

    There can be several reasons for this error message:

    • Several processes have the database open at the same time (see the FAQ).

    • There is a plugin to compress and encrypt the database. It doesn't allow to modify the DB.

    • Lastly, another FAQ says: "Make sure that the directory containing the database file is also writable to the user executing the CGI script." I think this is because the engine needs to create more files in the directory.

    • The whole filesystem might be read only, for example after a crash.

    • On Unix systems, another process can replace the whole file.

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

    If using Android.

    Make sure you have added the permission to write to your EXTERNAL_STORAGE to your AndroidManifest.xml.

    Add this line to your AndroidManifest.xml file above and outside your <application> tag.

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    

    This will allow your application to write to the sdcard. This will help if your EXTERNAL_STORAGE is where you have stored your database on the device.

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