I still fail to understand what should I synchronize on. I am *not* sharing sqlite* across multiple threads.
On 6/18/07, John Stanton <[EMAIL PROTECTED]> wrote:
It is fundamental computer science, CS101 you might say. Pick up a textbook on basic computing. Sabyasachi Ruj wrote: > But can you tell me where is this documented please? > > On 6/18/07, John Stanton <[EMAIL PROTECTED]> wrote: > >> >> If you knew the answer then why did you ask the question? You can apply >> regular CS or look for miracles. >> >> You might be better off using a server based RDBMS like Oracle or >> PostgreSQL where the application programmer is insulated from >> synchronization issues. Sqlite has the "lite" in its name for a very >> good reason. It is designed for embedded applications, not as an >> enterprise DBMS. >> >> Sabyasachi Ruj wrote: >> > But the following link >> > http://www.sqlite.org/cvstrac/wiki/wiki?p=MultiThreading >> > says nothing that I have to synchronize at the application level to >> create >> > multiple connections, until the same database connection is being >> shared! >> > Ref: The four points in 'Short Answer' section. >> > >> > BTW: for a DBMS it does not make sense if the application programmer >> has >> to >> > synchronize to create multiple connection. >> > And synhing will have considerable performance drop also. >> > >> > >> > On 6/18/07, John Stanton <[EMAIL PROTECTED]> wrote: >> > >> >> >> >> Threadsafe only means that threads do not access global data elements >> or >> >> that they synchronize (serialize) access to global data. It does >> >> nothing to synchronize threads. That is up to the application >> >> programmer. Sqlite uses POSIX file locks for synchronixation but if >> you >> >> are in a totally threaded environment you can use thread sync >> functions >> >> like mutexes or the finer grained read and write lock thread >> primitives. >> >> >> >> If you are accessing Sqlite across a network file locks are the way to >> >> go, but do depend upon network implementations and settings. If you >> >> have multiple processes on one OS you can sync using semaphores. >> >> >> >> Using textbook style synchronization ensures that you have minimal >> >> problems and optimal performance. >> >> >> >> Sabyasachi Ruj wrote: >> >> > But I think we do not have to take care of synchronizing sqlite >> access. >> >> > sqlite internally does if it is compiled with THREADSAFE=1. >> >> > >> >> > On 6/18/07, John Stanton <[EMAIL PROTECTED]> wrote: >> >> > >> >> >> >> >> >> The problem is fairly straight forward. Sqlite is a single >> resource >> >> >> being shared by multiple thyreads so you just use fundamental >> >> >> synchronization logic as you would when sharing any resource >> between >> >> >> competing threads. >> >> >> >> >> >> Sabyasachi Ruj wrote: >> >> >> > Hi, >> >> >> > >> >> >> > I am using sqlite in a multithreaded environment. I have take >> >> >> > reasonable like not sharing sqlite* handles. I am creating a new >> >> >> sqlite* >> >> >> >> >> >> > for >> >> >> > every thread. >> >> >> > >> >> >> > Where can we get more info on working with SQLite in a >> multithreaded >> >> >> > environment? >> >> >> > >> >> >> > The application is working as a service in windows. >> >> >> > >> >> >> > sqlite3_step() is failing with the following error message: >> >> >> > >> >> >> > * SQL error or missing database >> >> >> > SQL logic error or missing database* >> >> >> > >> >> >> > I am getting this message after running the application for quite >> a >> >> >> long >> >> >> > time (few days). >> >> >> > And then if I execute *PRAGMA INTEGRITY_CHECK* on that table, I >> get >> >> the >> >> >> > same >> >> >> > error message. >> >> >> > >> >> >> > My application updates the database very 2 mins and the >> corruption >> >> >> happend >> >> >> > randomly >> >> >> > >> >> >> > I dont have any clue how to debug this! >> >> >> > >> >> >> > Thanks. >> >> >> > >> >> >> > On 5/11/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> >> > >> >> >> >> "Sabyasachi Ruj" < [EMAIL PROTECTED]> wrote: >> >> >> >> > Hi, >> >> >> >> > Is there any way to programmatically fix a corrupted sqlite >> >> >> database? >> >> >> >> > I am using sqlite version 3.3.8 with C APIs >> >> >> >> > >> >> >> >> >> >> >> >> Sometimes VACUUM or REINDEX will help, but usually not. >> >> >> >> You can also try to recover using: >> >> >> >> >> >> >> >> sqlite3 OLD.DB .dump | sqlite3 NEW.DB >> >> >> >> >> >> >> >> But that doesn't always work either. The best approach >> >> >> >> is to avoid corruption in the first place. >> >> >> >> -- >> >> >> >> D. Richard Hipp <[EMAIL PROTECTED]> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> ----------------------------------------------------------------------------- >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> To unsubscribe, send email to >> [EMAIL PROTECTED] >> >> >> >> >> >> >> >> >> >> >> >> >> >> ----------------------------------------------------------------------------- >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> >> > >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> ----------------------------------------------------------------------------- >> >> >> >> >> >> >> >> >> To unsubscribe, send email to [EMAIL PROTECTED] >> >> >> >> >> >> >> >> >> ----------------------------------------------------------------------------- >> >> >> >> >> >> >> >> >> >> >> >> >> >> > >> >> > >> >> >> >> >> >> >> >> >> ----------------------------------------------------------------------------- >> >> >> >> >> To unsubscribe, send email to [EMAIL PROTECTED] >> >> >> >> >> ----------------------------------------------------------------------------- >> >> >> >> >> >> >> >> > >> > >> >> >> >> ----------------------------------------------------------------------------- >> >> To unsubscribe, send email to [EMAIL PROTECTED] >> >> ----------------------------------------------------------------------------- >> >> >> > > ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------
-- Sabyasachi

