MySQL Forums
Forum List  »  SQLite

overcoming sqlite "database locked' error
Posted by: Allasso Travesser
Date: August 12, 2009 12:10PM


I would like to pass cookies back and forth between a search script I have written that runs on the local system, and javascript pages displaying the forms and results in Firefox. I'll forego all the gory details here, it is working pretty well, but being able to pass cookies back and forth would make allow me to make it much more robust. FF (3+) uses an sqlite db to store it's cookies. I have tried to edit cookies using sqlite3, but I keep getting a 'database locked' error, incessantly. (Does FF simply put a lock on this file at the beginning of a session and not release it til it is done?)

I have read things that talk about using fcntl() to get around this, but it is quite over my head, though I am willing to invest, as I really want to accomplish this.

If I could get some suggestions on how to handle this situation to my ends, I would much appreciate it. I could just simply dump the db, alter the cookie values, create a new db with the modified dump file, and then copy it over the existing cookies db. This works. Perhaps a more kosher way would be to use fcntl() to get an exclusive lock beforehand. This is an area I am quite unfamiliar with, but willing to invest in learning if it seems feasible. I really would like to be able to edit the cookies outside of FF and I believe there is a way without just forcing it. Reading them is no problem, but I want to be able to write flags back to the javascript while it is running.

Perhaps copying over the db file is not such a big deal, after all, this would (most likely) only be occurring while the user is using the search feature anyway. Any thoughts on this? But if I can do this in a more kosher manner, it would be better.

Any input on this?

Thanks much,


Options: ReplyQuote

Written By
overcoming sqlite "database locked' error
August 12, 2009 12:10PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.