On Tuesday, 9 May, 2017 15:02, Wolfgang Enzinger <sql...@enzinger.net> enquired,

> since it's wise to store SQLite databases on local HDs (as opposed to
> network filesystems) in order to avoid corruption, 

As long as you understand what a "network filesysem" is.  A "network 
filesystem" is a filesystem that is remote (run on a different computer).  The 
underlying storage device (and its location) is irrelevant.

SQLite databases need to be stored on "Local Filesystems", not on 
"Remote/Network Filesystems".  The locality of the underlying storage device is 
irrelevant.  It could be a "locally-located remote" spinning magnetic disk 
attached to your computer by a mere 6-inch SATA cable, or a "not so local 
remote" spinning magnetic disk attached to your computer via a fibre-optic 
cable spanning the earth (perhaps Fibre-channel, iSCSI, or even SATA over IP).  
In either case the protocol used to attach the "remote disk" to the "local 
computer filesystem" is running a block oriented protocol and is not a "remote 
filesystem".  The filesystem is running on the self-same computer as is hosting 
the application using the database.

Conversely, storing an SQLite database on a "remote filesystem" provided by a 
raspberry pi running Windows that is attached to your computer via a 3-inch 
ethernet cable and a database on a remote filesystem residing on a Cray 
computer located on the other side of the planet via NFS is equally subject to 
corruption because in this case the filesystem resides on a "remote" computer 
(that is not the same computer on which the application accessing the database 
resides).

> I would like to have my
> program check if this requirement is fulfilled. I'm on Windows so I use
> GetDriveType() for testing the DB path. Now I noticed that this function
> returns DRIVE_FIXED also for drives that are actually USB connected
> external HD volumes. 
> Anybody got any experiences if this is actually a
> safe place for an SQLite-DB? 

Is the filesystem running on the same (local) computer running the application 
accessing the database?  If so, there is no problem.  This is true even for 
1000-mile long USB cables where the filesystem is provided by the local 
computer and not a remote computer.

> If it's not, any ideas as to how one can
> distinguish such drives from "real" HDs?

You can store an SQLite database on a RAMDISK, an SSD, or any of the many 
thousand of other types of storage devices on which the "local computer" (the 
one running the application accessing the database) runs the filesystem.  The 
underlying block storage media is irrelevant.  Only the locality of the 
filesystem is important.

If Windows reports that the filesystem is "local" then it is OK.  If Windows 
reports that the filesystem is "remote", then it is ungood.  A "drive mapped to 
the local computer" is a remote filesystem, for example, and is ungood.  A 
local filesystem accessing a storage device via a really long cable is still a 
local filesystem and is good (even though the storage device itself may be 
located in a very remote part of Siberia, very far away from your computer in 
sunny Florida).





_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to