Regarding the configuration of NFS -
I have two machines with NFS on them.
- if i run the app on machine 1 it works properly
- now when i run the app on machine 2 it works properly

But if I login to machine 2 from machine 1 and then run the app I get
the 'database is locked' error message.

The sequence of statements are -

1  if((fp = fopen(fullFileName.c_str(),"w+"))) 
2  {
3     fclose(fp);
4  }
5  else
6  {
7     printf("Error creating file");
8     return;
9  }
10 int res = sqlite3_open(fullFileName.c_str(), &_db);
11 if( res != SQLITE_OK )
12 {
13     printf("Error opending DB");
14     sqlite3_close(_db);
15     return;
16 }
17 
18 sqlite3_trace(getDB(),logSqlQuery,&sqlLogList);
19 string query = "create table XYZ";
20 res =  sqlite3_exec(_db, query.c_str(), NULL , 0, &errmsg);
21
22 if(res == 5)
23 ....


After line #20 the value of 'res' is 5.  

I've even tried to run the app after removing line #18 which contains
the sqlite3_trace() fn call.  But that dosen't seem to be the cause.

I've gone through the mail archive of this list and saw that this
problem did appear for others as well but there the solution was to
check if a previously executing sql statement was still not finished
with its job and a another sql statement was being executed.

Over here the first sql statement's execution returns this error.

Another assumption that I made was that the host machine locks the file
after I open a sqlite connection (line #10).  So I should wait for it to
release this lock.  I ran the app using GDB and after line #10 I paused
the app for some time hoping that the lock would go away but the problem
persists even after pausing for 10, 20 and 30 minutes in seperate runs.


If NFS is the problem then what configurations do I need to look at and
change to make my app work properly?

What if the problem is with the host machine locking the file or some
other process running on my machine or the host machine which locks the
file?  Is this possible?  

If yes then is there a way to find out which process is doing this
through the entries in /proc directory?


Thanks,
Ritesh



On Mon, 2006-01-30 at 19:31, [EMAIL PROTECTED] wrote:
> Ritesh Kapoor <[EMAIL PROTECTED]> wrote:
> > Yes.
> > My machine has NFS and the machines I log onto also have NFS.  But if
> > this is the problem then why dosen't it appear on my machine when I run
> > the app.
> 
> Perhaps you are using a local filesystem when you run on 
> your machine.  Or perhaps NFS is configured properly on
> your machine but not on the other machines.
> 
> 
> > Is there a workaround for this? without having to change the file system
> > from NFS.
> > 
> 
> Yes.  Configure your NFS so that file locking works correctly.
> 
> --
> D. Richard Hipp   <[EMAIL PROTECTED]>
> 

Reply via email to