Attempt to write in a readonly database ERROR
-
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!
Use a better database system?
-
Use a better database system?
-
It may be that it isn't suited for your environment, but that's something you'll have to determine.
-
It may be that it isn't suited for your environment, but that's something you'll have to determine.
-
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"..
DPaul1994 wrote:
I need in "Program Files"..
No. That's the wrong place. (If Windows) try the ProgramData or %userdata% directories.
-
Use a better database system?
-
"suited for your environment" :~ (PIEBALD carefully balances on a fence.)
-
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!
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)
-
"suited for your environment" :~ (PIEBALD carefully balances on a fence.)
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)
-
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!
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.