Database lock problem.

Jan-Henrik Haukeland hauk at tildeslash.com
Mon Oct 30 19:25:04 CET 2006


This is a SQLite specific problem in that SQLite does not have any  
fine grained locking mechanism. It actually locks the whole database  
file on write. Locking strategies for SQLite are discussed at their  
wiki pages, which you may want to take a look at.

It seems that part of this problem has been fixed in a later SQLite  
versions, see http://www.sqlite.org/cvstrac/wiki?p=DatabaseIsLocked

If you decide to test with SQLite version 3.3.7 or later, please let  
us know if this fix the problem for you.

Best regards
--
Jan-Henrik Haukeland
Mobil +47 97141255


On 30. okt. 2006, at 17.34, José Antonio Sánchez wrote:

> Hello, I'm having a problem with libzdb. I have a connection pool to
> sqlite and I get a connection to perform a select query. Now, while
> processing the result set I want to update certain tables from the
> database. The problem is:
>
> If I get a new connection from the pool I get a "database file is
> locked" so I'm gessing that a connection locks the database file while
> it's active. The other solution may be to use the same conection to
> execute the update, but that messes the result set to when it tries to
> get next element I get a Segmentation Fault.
>
> Is there a way to open a "Read only" connection so it doesn't lock the
> entire database? If not, is there a way to make a copy of a result set
> to execute another query?
>
> -- 
> Saludos.
> José Antonio Sánchez




More information about the libzdb-general mailing list