> My question is: supposed NFS implementes fcntl() correctly, can > multiple applications from different hosts access a single database > file on NFS at the same time?
If fcntl() is implemented correctly on all hosts using database (including one where the physical disk is located) then yes they can. But the general rule is: it isn't implemented correctly. And the sad truth is that you can't prove (in)correctness in any other way than running your applications in production and waiting for a "malformed database" error. If you've encountered this error then you'll see that you just proved the general rule. If you don't ever see this error then you're lucky to have some good NFS implementations. And now it's up to you to calculate costs and answer a question: can you afford trashing your database at some unpredictable point of time? Pavel On Thu, Mar 4, 2010 at 5:59 AM, Zhigang Wang <w1z...@gmail.com> wrote: > Hi all, > > My question is: supposed NFS implementes fcntl() correctly, can > multiple applications from different hosts access a single database > file on NFS at the same time? > > After reading http://www.sqlite.org/faq.html#q5 and > http://www.sqlite.org/lockingv3.html carefully, I still cannot get a > positive answer. > > I think the answer is: > > * SELECT is supported. > * SQLite will automatically serialize any changes to the db, no extra > action (eg. flock()) is needed by the user application. Eg. for > python, I can execute the following actions on different hosts: > > conn = sqlite3.connect('/nfs/example') > c = conn.cursor() > c.execute("""insert into stocks values > ('2006-01-05','BUY','RHAT',100,35.14)""") > conn.commit() > c.execute("""insert into stocks ....""") > conn.commit() > .... > > Please kindly confirm my thought. > > Thanks, > > Zhigang > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users