On Thu, 10 Jun 2004, Drew, Stephen wrote: >Tito, > >Thanks for that. I've had a look but it doesn't really help. The two main >questions are: > >1.) Why do I need a separate sqlite pointer for each thread, if I am >protecting access to it?
I've always wondered that. I can't think of a reason why you'd need to so long as the sqlite pointer is protected. That said, for read only access, a sqlite pointer per thread allows increased concurrency for reads. >2.) Even aside from this, I am using multiple threads to access the >database, each opens it when it needs it, and this is protected by a >critical section, so I have a separate pointer per thread and only one >thread is accessing the DB at a time. Why do I get "Can't open database" >error? Is this something to do with the filesystem locking? Perhaps sleeping >for a few milliseconds might help? If you're repeatedly opening the database, make sure you close the database as well when you're finished with it, by calling sqlite_close on the sqlite pointer. Otherwise, I'm out of ideas. > >Regards, >Steve > >-----Original Message----- >From: Tito Ciuro [mailto:[EMAIL PROTECTED] >Sent: Thursday, June 10, 2004 4:13 PM >To: Drew, Stephen >Cc: '[EMAIL PROTECTED]' >Subject: Re: [sqlite] Can't Open Database File > >Hi Stephen, > >Check this: http://www.sqlite.org/cvstrac/wiki?p=MultiThreading > >Regards, > >-- Tito > >On 10 jun 2004, at 17:05, Drew, Stephen wrote: > >> From the SQLite FAQ: >> >> "Threadsafe" in the previous paragraph means that two or more threads >> can run SQLite at the same time on different "sqlite" structures >> returned from separate calls to sqlite_open(). It is never safe to use >> the same sqlite structure pointer simultaneously in two or more >> threads. >> >> Is it still not safe to use the same SQLite structure pointer in two >> or more threads if they are protecting against concurrent use? >> >> Regards, >> Steve >> >> -----Original Message----- >> From: Drew, Stephen [mailto:[EMAIL PROTECTED] >> Sent: Thursday, June 10, 2004 3:38 PM >> To: '[EMAIL PROTECTED]' >> Subject: [sqlite] Can't Open Database File >> >> Hi there, >> >> I am having a problem with accessing my SQLite database. >> >> I have a certain number of worker threads that access the SQLite >> database, protected by a critical section. >> >> The database is already open prior to this. Each thread attempts to >> insert a row protected by the critical section. This works fine for >> about thirty rows, but then I get a "Can't open database file" error. >> >> Does anyone have any clues to what might be going on? >> >> Many thanks, >> Steve >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > -- /"\ \ / ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL X - AGAINST MS ATTACHMENTS / \ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

