Firefox locks places.sqlite
Platform: Firefox 3.6.13, Python 2.7 stackless, and Windows 7 (not yet tested on Ubuntu, I will...)
I tried with the apsw library:
conn = apsw.Connection( dir + profile + '/places.sqlite', apsw.SQLITE_OPEN_READONLY )
And I got the error:
File "c:\apsw\src\statementcache.c", line 386, in sqlite3_prepare apsw.BusyError: BusyError: database is 开发者_开发技巧 locked
I see "SQLite manager" can open the database also with Firefox running.
I just want to open and read, I think a trouble free operation. And I cannot use "SQLite manager". I need to code my Python (or PHP or Perl) script.
1) Which type of lock does Firefox use on the SQLite file? Why?
2) How does "SQLite manager" work?
Q2) SQLite Manager works in JavaScript, inside Firefox, so it can access the database.
This is not what I am looking for: An external application reading places while Firefox is running.
I am not sure about the lock type Firefox uses, but I'd recommend this:
Copy the Firefox database file to a different temporary location and read it from there (this also lowers the risk of accidentally damaging the original file).
I haven't had problems with this method yet on Firefox 3.*.
Firefox uses SQLite to obtain an EXCLUSIVE lock on the database, which is why you cannot open it: http://www.sqlite.org/pragma.html#pragma_locking_mode
精彩评论