On Mon, 25 Apr 2016 08:42:26 Richard Hipp <drh at sqlite.org> wrote:

> If you put the databases in WAL-mode (https://www.sqlite.org/wal.html)
> using "PRAGMA journal_mode=WAL;" then this problem will likely go away
> (depending on what it is that Thunderbird is doing.)  I suggest trying
> that approach first.

Rather interesting results:

sqlite3 "mydbpath" \
  "PRAGMA journal_mode=WAL;select distinct value from cal_properties where key 
= 'CATEGORIES'"
Error: attempt to write a readonly database

At first, I thought the problem was that I had the directory mounted ro, but 
when
I remounted rw I still got this error. Not sure where or why the DB is being set
as read-only. Possibly a Windows permission thing. 

Anyway, read-only is good, but that means the WAL idea won't work and maybe 
Simon
Slavin's timeout idea is a better approach (except for outputting the timeout
value to stdout).

I wonder, then, why I get a lock error if the database is read-only in the first
place?

THX --Mark

-----Original Message-----
> Date: Mon, 25 Apr 2016 08:42:26 -0400
> From: Richard Hipp <drh at sqlite.org>
> To: SQLite mailing list <sqlite-users at mailinglists.sqlite.org>
> Subject: Re: [sqlite] sqlite3 command line, read-only
>
> On 4/25/16, Mark Foley <mfoley at novatec-inc.com> wrote:
> > I'm new to the list, so apologies if this has been posted before.
> >
> > I am using sqlite3 3.7.17 on Linux Slackware64 14.1. I use the sqlite3
> > command
> > every 10 minutes to query several Thunderbird calendar databases.
> > Occasionally, I
> > have a message, "Error: database is locked"; understandable since
> > Thunderbird
> > is occasionally updating its database.
>
> If you put the databases in WAL-mode (https://www.sqlite.org/wal.html)
> using "PRAGMA journal_mode=WAL;" then this problem will likely go away
> (depending on what it is that Thunderbird is doing.)  I suggest trying
> that approach first.
>
> >
> > First, is there a way to open a database in readonly mode from the command
> > line?
> > I 've searched the man page and googled, but I find nothing. I've tried
> > opening
> > the database as dbname?mode=ro, but that doesn't work. The C API has such a
> > mode, but apparently not the command line.
> >
> > If the answer to that question is "no", I would like to request that a
> > readonly
> > switch be added to future versions of sqlite. I think this would be
> > generally
> > useful and couldn't be that difficult to implment.
> >
> > Thanks, Mark
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
>
>
> -- 
> D. Richard Hipp
> drh at sqlite.org
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

Reply via email to