tags:

views:

967

answers:

5

Hello - I have created a simple database using SQLite (actually PySQLite). It works fine when I'm querying or writing to the database from the local machine (ie program and database file on the windows machine drive). However when I copy the database file to my network drive (a time capsule), then Windows machines, although they can see the files and have full read/write access to the drive, give me a "SQL Error: database is locked" even when performing a simple select!

Queries work fine over the network from Macs.

There is no fancy multi-access going on - only one machine has the database open. Seems like some weird Mac networking issue. Happens in either the Python program, or in the SQLite3 command line. I am using SQLite 3.6.14.2.

Anybody seen this problem? Any way of fixing it? Don't really want to get heavy with MYSQL because this is a simple single-user program, but i'd like to use it from multiple machines.

Thanks.

+1  A: 

Possibly it fails to lock the file over the network, I think you use SMB protocol so the bugginess comes with the package. If you would like to use SQLite over the network see SQLite Network for alternatives.

cartman
A: 

I've had a similar problem and I solved it by installing a newer sqlite version. Since Python 2.6 the problem has disappeared too because it uses a newer sqlite dll.

Georg
Wish that were so. Sadly I am running the very latest version of SQLite. Basically, looks like SQLite won't work when a windows client queries a file on a mac-based network (in my case Time Capsule). Going to play with other permutations such as running the database on a windows or other *Nix based machine.
+2  A: 

Read the sqlite FAQ: http://www.sqlite.org/faq.html#q5

"People who have a lot of experience with Windows tell me that file locking of network files is very buggy and is not dependable. If what they say is true, sharing an SQLite database between two or more Windows machines might cause unexpected problems."

So it doesn't work on Windows, it doesn't tell about MAC.

tuinstoel
A: 

hi is this problem resolved. I am facing similar issue. please respond if anyone has a solution for this.

+1  A: 

I don't know if it can be done on MAC, on Debian I have to mount the samba directory with the nobrl option.

From mount.cifs(8):

  nobrl
      Do not send byte range lock requests to the server. This is
      necessary for certain applications that break with cifs
      style mandatory byte range locks (and most cifs servers do
      not yet support requesting advisory byte range locks).
Carlos