Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. System.Data.SQLite gives attempt to write to read only database

System.Data.SQLite gives attempt to write to read only database

Scheduled Pinned Locked Moved C#
helpcsharpdatabasesqlitewinforms
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rbsbscrp
    wrote on last edited by
    #1

    Hi All, I am _occasionally_ (inconsistently) getting "Attempt to write to read only database" problems with System.Data.SQLite. Googling this issue brings up lots of pages talking about file/folder permission issues (especially with web servers). I have a Windows Forms App and no web server is involved. Additionally, this problem happens inconsistently (like with every 20 Inserts) and I've got my database in %APPDATA%\MyApp folder (where %APPDATA% is set to the ...AppData\Roaming folder on my data drive). I have no reason to suspect a file/folder permissions problem. I added a delay to each Insert and I observe that the number of, and likelihood of getting a "Attempt to write..." error is directly related to the length of the delay - a delay of 1 second after each Insert seems to *almost* completely relieve the problem. Do I have a misconfiguration problem? Searching the net shows lots of positive comments for the stability and correctness of System.Data.SQLite and no solutions suggested except for file permissions config, but my system behaves like SQLite is tripping over itself. There are no other file operations (outside of the OS activity) happening at the same time. I'm out of ideas - help! I'm using C# vs2008 (I think it's .net 3.5). It was a Win7 box but now it's a Win8 box (no difference for this issue).

    L J 2 Replies Last reply
    0
    • R rbsbscrp

      Hi All, I am _occasionally_ (inconsistently) getting "Attempt to write to read only database" problems with System.Data.SQLite. Googling this issue brings up lots of pages talking about file/folder permission issues (especially with web servers). I have a Windows Forms App and no web server is involved. Additionally, this problem happens inconsistently (like with every 20 Inserts) and I've got my database in %APPDATA%\MyApp folder (where %APPDATA% is set to the ...AppData\Roaming folder on my data drive). I have no reason to suspect a file/folder permissions problem. I added a delay to each Insert and I observe that the number of, and likelihood of getting a "Attempt to write..." error is directly related to the length of the delay - a delay of 1 second after each Insert seems to *almost* completely relieve the problem. Do I have a misconfiguration problem? Searching the net shows lots of positive comments for the stability and correctness of System.Data.SQLite and no solutions suggested except for file permissions config, but my system behaves like SQLite is tripping over itself. There are no other file operations (outside of the OS activity) happening at the same time. I'm out of ideas - help! I'm using C# vs2008 (I think it's .net 3.5). It was a Win7 box but now it's a Win8 box (no difference for this issue).

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      A long shot; but do you have any indexes defined in there that it might try to update[^]?

      Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

      R 2 Replies Last reply
      0
      • L Lost User

        A long shot; but do you have any indexes defined in there that it might try to update[^]?

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        R Offline
        R Offline
        rbsbscrp
        wrote on last edited by
        #3

        Thx for the reply. No, I did not explicitly add any indexes (indices?). I just did a "CREATE TABLE..." and followed it up with Inserts and Selects. The Selects work fine. The Inserts don't. I'll take a look with that ANALYSE command that you reference.

        1 Reply Last reply
        0
        • L Lost User

          A long shot; but do you have any indexes defined in there that it might try to update[^]?

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

          R Offline
          R Offline
          rbsbscrp
          wrote on last edited by
          #4

          OK I ran the ANALYZE statement but it doesn't show anything. Any other ideas?

          1 Reply Last reply
          0
          • R rbsbscrp

            Hi All, I am _occasionally_ (inconsistently) getting "Attempt to write to read only database" problems with System.Data.SQLite. Googling this issue brings up lots of pages talking about file/folder permission issues (especially with web servers). I have a Windows Forms App and no web server is involved. Additionally, this problem happens inconsistently (like with every 20 Inserts) and I've got my database in %APPDATA%\MyApp folder (where %APPDATA% is set to the ...AppData\Roaming folder on my data drive). I have no reason to suspect a file/folder permissions problem. I added a delay to each Insert and I observe that the number of, and likelihood of getting a "Attempt to write..." error is directly related to the length of the delay - a delay of 1 second after each Insert seems to *almost* completely relieve the problem. Do I have a misconfiguration problem? Searching the net shows lots of positive comments for the stability and correctness of System.Data.SQLite and no solutions suggested except for file permissions config, but my system behaves like SQLite is tripping over itself. There are no other file operations (outside of the OS activity) happening at the same time. I'm out of ideas - help! I'm using C# vs2008 (I think it's .net 3.5). It was a Win7 box but now it's a Win8 box (no difference for this issue).

            J Offline
            J Offline
            Jammer 0
            wrote on last edited by
            #5

            Did you ever get to the bottom of this? I've just started seeing the same behavior on an app that has been stable for years. Really odd.

            Jammer My Blog | JamSoft

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups