Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread drh
"Sabyasachi Ruj" <[EMAIL PROTECTED]> wrote: > I still fail to understand what should I synchronize on. I am *not* sharing > sqlite* across multiple threads. > If you compile SQLite so that it is threadsafe (-DTHREADSAFE=1) and if you do not share sqlite3* pointers across threads, then you should

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread John Stanton
You said that you were sharing Sqlite between threads by opening a connection in each thread. Sqlite is a single resource and must be sync'd somehow if it has multiple users. Complaining about it is like complaining that the sky is blue. It is blue because of Rayleigh scattering, a

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread Andrew Finkenstadt
- Make sure you're compiling SQLite with *-DTHREADSAFE=1*. - Make sure that each thread opens the database file and keeps its own sqlite structure. - Make sure you handle the likely possibility that one or more threads collide when they access the db file at the same time: handle *

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread Sabyasachi Ruj
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

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread John Stanton
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

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread Sabyasachi Ruj
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

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread John Stanton
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

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread Sabyasachi Ruj
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

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread John Stanton
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

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread Sabyasachi Ruj
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

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread John Stanton
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

Re: [sqlite] SQLITE_CORRUPT recover

2007-06-18 Thread Sabyasachi Ruj
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.

Re: [sqlite] SQLITE_CORRUPT recover

2007-05-11 Thread drh
"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

[sqlite] SQLITE_CORRUPT recover

2007-05-11 Thread Sabyasachi Ruj
Hi, Is there any way to programmatically fix a corrupted sqlite database? I am using sqlite version 3.3.8 with C APIs -- Sabyasachi