Re: [sqlite] Occasional Database is Locked Error
Hi All, This is the exaclty approach that I used in my code. No way to reduce/minimize the lock issue regardless about the reading or the writting. We need to have to code to sleep and re-try the command again. JP - Original Message From: Richard Klein <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Wednesday, December 12, 2007 11:59:04 AM Subject: Re: [sqlite] Occasional Database is Locked Error Mark Riehl wrote: > Am I just getting [un]lucky and issuing selects at the same time I'm > writing from the other process? Yes. > I'm planning on using a web-based app > to periodically poll the database (to provide summary information) > while the C++ app performs the inserts. What is the best way to > reduce/minimize the lock issue? There is no way to reduce/minimize the lock issue. "Database is locked" is a "normal" error return that your polling app must be prepared to deal with. As other folks have noted, the way to deal with it is to sleep for awhile and then retry the SELECT. - Richard Klein - To unsubscribe, send email to [EMAIL PROTECTED] - Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping
Re: [sqlite] Occasional Database is Locked Error
Mark Riehl wrote: Am I just getting [un]lucky and issuing selects at the same time I'm writing from the other process? Yes. I'm planning on using a web-based app to periodically poll the database (to provide summary information) while the C++ app performs the inserts. What is the best way to reduce/minimize the lock issue? There is no way to reduce/minimize the lock issue. "Database is locked" is a "normal" error return that your polling app must be prepared to deal with. As other folks have noted, the way to deal with it is to sleep for awhile and then retry the SELECT. - Richard Klein - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Occasional Database is Locked Error
John Stanton wrote: Your application needs to handle the synchronization logic since there is no DB server to do it for you. When you get a busy check you can pause for a short time and relaunch the query. Mark Riehl wrote: I'm running SQLite 3.4.1 under Linux. I have a C++ application that inserts records into the database. During testing, I lauch the C++ app and I start sqlite3 from a console and open the database that is being written to by the C++ application. I perform selects using sqlite3 (no inserts) to look at the collected data and occasionally get "Error: database is locked". Sometimes get the error a few times in a row, other times, it doesn't happen at all. I think he is saying that he is getting the errors in the sqlite3 command shell, not in his application. To fix that you should issue a .timeout 1000 command in the shell when you open it. That will cause a query to wait up to one second (1000 ms) if the database is locked by your application when it is writing. HTH Dennis Cote - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Occasional Database is Locked Error
Your application needs to handle the synchronization logic since there is no DB server to do it for you. When you get a busy check you can pause for a short time and relaunch the query. Mark Riehl wrote: I'm running SQLite 3.4.1 under Linux. I have a C++ application that inserts records into the database. During testing, I lauch the C++ app and I start sqlite3 from a console and open the database that is being written to by the C++ application. I perform selects using sqlite3 (no inserts) to look at the collected data and occasionally get "Error: database is locked". Sometimes get the error a few times in a row, other times, it doesn't happen at all. I'm not inserting a lot of records - worst case, there are ~25 records per second. Am I just getting lucky and issuing selects at the same time I'm writing from the other process? I'm planning on using a web-based app to periodically poll the database (to provide summary information) while the C++ app performs the inserts. What is the best way to reduce/minimize the lock issue? Thanks for the help, Mark - To unsubscribe, send email to [EMAIL PROTECTED] - - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Occasional Database is Locked Error
I'm running SQLite 3.4.1 under Linux. I have a C++ application that inserts records into the database. During testing, I lauch the C++ app and I start sqlite3 from a console and open the database that is being written to by the C++ application. I perform selects using sqlite3 (no inserts) to look at the collected data and occasionally get "Error: database is locked". Sometimes get the error a few times in a row, other times, it doesn't happen at all. I'm not inserting a lot of records - worst case, there are ~25 records per second. Am I just getting lucky and issuing selects at the same time I'm writing from the other process? I'm planning on using a web-based app to periodically poll the database (to provide summary information) while the C++ app performs the inserts. What is the best way to reduce/minimize the lock issue? Thanks for the help, Mark - To unsubscribe, send email to [EMAIL PROTECTED] -