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. Attempt to write in a readonly database ERROR

Attempt to write in a readonly database ERROR

Scheduled Pinned Locked Moved C#
helpcsharpdatabasevisual-studiotutorial
11 Posts 4 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.
  • D DPaul1994

    Hi. I created an aplication in C# (Visual Studio 2013) which uses an SQLiteDatabase. To install it on a computer I used Install Shield. But when I run the program and I try to modify some data from database, I receive: "attempt to write in a readonly database", twice. I know I receive that because the user does not have rights to modify that file (database.db) from installation folder but I don't know how to fix this because this app will be installed on other computers and every user should modify the rights for that location folder which is not an option. Any help is welcomed. Thanks!

    P Offline
    P Offline
    PIEBALDconsult
    wrote on last edited by
    #2

    Use a better database system?

    D L 2 Replies Last reply
    0
    • P PIEBALDconsult

      Use a better database system?

      D Offline
      D Offline
      DPaul1994
      wrote on last edited by
      #3

      Well you think the problem is the database?

      P 1 Reply Last reply
      0
      • D DPaul1994

        Well you think the problem is the database?

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #4

        It may be that it isn't suited for your environment, but that's something you'll have to determine.

        D 1 Reply Last reply
        0
        • P PIEBALDconsult

          It may be that it isn't suited for your environment, but that's something you'll have to determine.

          D Offline
          D Offline
          DPaul1994
          wrote on last edited by
          #5

          What exactly do you mean with "for your environment"? What should I do in that case? I google for an answer, but I didn't find one..I changed the folder destionat and it worked, but I need in "Program Files"..

          P 1 Reply Last reply
          0
          • D DPaul1994

            What exactly do you mean with "for your environment"? What should I do in that case? I google for an answer, but I didn't find one..I changed the folder destionat and it worked, but I need in "Program Files"..

            P Offline
            P Offline
            PIEBALDconsult
            wrote on last edited by
            #6

            DPaul1994 wrote:

            I need in "Program Files"..

            No. That's the wrong place. (If Windows) try the ProgramData or %userdata% directories.

            1 Reply Last reply
            0
            • P PIEBALDconsult

              Use a better database system?

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

              Please explain "better" :)

              Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

              P 1 Reply Last reply
              0
              • L Lost User

                Please explain "better" :)

                Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #8

                "suited for your environment" :~ (PIEBALD carefully balances on a fence.)

                L 1 Reply Last reply
                0
                • D DPaul1994

                  Hi. I created an aplication in C# (Visual Studio 2013) which uses an SQLiteDatabase. To install it on a computer I used Install Shield. But when I run the program and I try to modify some data from database, I receive: "attempt to write in a readonly database", twice. I know I receive that because the user does not have rights to modify that file (database.db) from installation folder but I don't know how to fix this because this app will be installed on other computers and every user should modify the rights for that location folder which is not an option. Any help is welcomed. Thanks!

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

                  Simple; put the databasefile in a location where EVERYONE can access it. If the user has no rights, he/she will not be able to modify the file's contents, it's that simple. As PIEBALD suggested, you could opt for a database-server. Those usually connect over TCP/IP, and have their own authentication - one that is not determined by the file-system.

                  Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                  1 Reply Last reply
                  0
                  • P PIEBALDconsult

                    "suited for your environment" :~ (PIEBALD carefully balances on a fence.)

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

                    Looking at the fence, I'd say it is pretty sturdy :) The database is not chosen only based on environment; having a server would solve the problem with the file-system rights, but would also be quite a bit overkill if the application is comparable to, say, KeePass. By the way it reads, it would be data that is accessed by multiple users simultaneous. In that case, SQLite definitely is not suited for the task, as only one person can have a file open for writing at a time.

                    Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

                    1 Reply Last reply
                    0
                    • D DPaul1994

                      Hi. I created an aplication in C# (Visual Studio 2013) which uses an SQLiteDatabase. To install it on a computer I used Install Shield. But when I run the program and I try to modify some data from database, I receive: "attempt to write in a readonly database", twice. I know I receive that because the user does not have rights to modify that file (database.db) from installation folder but I don't know how to fix this because this app will be installed on other computers and every user should modify the rights for that location folder which is not an option. Any help is welcomed. Thanks!

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #11

                      When you installed your database, did you by any chance install it into your program directory? You know, the directory that's normally protected so that software can't do malicious things to your system.

                      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