I did the following...so what kind of permissions do you have that are 
different from this?
 
drwxr-xr-x 2 root   root  4096 Jun 11 08:40 ./
-rw-r--r-- 1 root   root 2048 Jun 11 08:40 test.db
As a normal user I did this:
 
sqlite3 test.db
SQLite version 3.3.6
Enter ".help" for instructions
sqlite> insert into data_his values(3,'test');
SQL error: attempt to write a readonly database

Clear as a bell...
 
What's different about your setup?  Different permissions on the directory or 
file?
 
 
Michael D. Black
Senior Scientist
Northrop Grumman Mission Systems
 

________________________________

From: sqlite-users-boun...@sqlite.org on behalf of Pavel Ivanov
Sent: Fri 6/11/2010 8:22 AM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] bug report: unhelpful error message when 
directorypermissions are wrong



> Finally I found that in
> order to write to the database, Sqlite for some reason needs to have
> write permissions to the _folder_ the file resides in.

"Some reason" here is a necessity to create a journal file at the same
directory to be able to restore the database in case of crash or power
outage. To create files in the directory one must have write
permissions to it.


Pavel

On Fri, Jun 11, 2010 at 7:22 AM, Otto Kekäläinen <o...@sange.fi> wrote:
> Hello,
>
> You website states that bugs reports should be sent to this list
> (http://www.sqlite.org/src/wiki?name=Bug+Reports).
>
> **
> Bug report: unhelpful error message when directory permissions are wrong
>
> Steps to reproduce:
> 1. Make new database in the directory /var/database/ with root permissions.
> 2. Change file ower to normal user
> 3. Try to open database and make changes to it as the normal user
>
> What happends:
> There is the error message "sqlite: Unable to open database file"
>
> What was expected:
> The error message: "sqlite: Unable to write to database due to file or
> folder permissions"
>
> I just spent several hours trying to debug a PySqlite app which gave
> the "unable to open database file" error. Finally I found that in
> order to write to the database, Sqlite for some reason needs to have
> write permissions to the _folder_ the file resides in.
>
> Please change the error message to be more descriptive so that others
> could save time debugging the issue. You can find on Google tons of
> people wondering about this error, but few will ever find the
> solutions. Fixing the error message would solve it.
> **
>
> --
> Otto Kekäläinen
> www.sange.fi
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to