On Feb 16, 2010, at 7:30 AM, Erik de Castro Lopo wrote:

> Erik de Castro Lopo wrote:
>
>> Hi all,
>>
>> I've got some relatively simple code that does a query and then
>> does the following:
>>
>>    const char *stmt = "DELETE FROM connect WHERE machine = 'xxx';" ;
>>
>>    printf ("Before : %s\n", sqlite3_errmsg (pdb)) ;
>>    sqlite3_exec (pdb, stmt, NULL, NULL, NULL) ;
>>    printf ("After : %s\n", sqlite3_errmsg (pdb)) ;
>>
>> The query that happens before this works as expected and then the
>> above results in:
>>
>>    Before : not an error
>>    After : unable to open database file
>>
>> Obviously, at the 'Before', the database was open and valid so I
>> don't understand why it returns a database not open error after the
>> sqlite_exec() statement.
>>
>> I'm using the default sqlite libs on Ubuntu Hardy:
>
> Getting the same result on Ubuntu Karmic.
>
> SELECT queries after the above exec failure work as they should.
>
> Pulling the problem code out of the bigger project (an openvpn
> authorisation plugin) into a standalone binary and it works
> perfectly.
>
> Its got me stumped.

That message is better interpreted as "failed to open some file".
Not necessarily the database file, the same message is returned if
sqlite fails to open or create a journal or temporary file.

First guess is that you do not have permission to create a journal
file. To write to a database sqlite requires permission to write to
the directory the database file resides in, not just to write to the
database file itself.

Dan.


>
> Erik
> -- 
> ----------------------------------------------------------------------
> Erik de Castro Lopo
> http://www.mega-nerd.com/
> _______________________________________________
> 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