View Single Post
Old 02-09-2013, 02:53 PM   #5
mwaterbu
Junior Member
mwaterbu began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jan 2012
Device: Kindle Keyboard 3G
Quote:
Originally Posted by murkyl View Post
So there is a workaround fortunately! Calibre has the capability to have the metadata database in a different directory from the library itself. You need to set it with the full path including the name of the database file in an environment variable named:
e.g. C:\Some\Path\metadata.db
This is documented here: http://manual.calibre-ebook.com/customize.html

This link here in the forums also helped: http://www.mobileread.com/forums/sho...d.php?t=190436

It turns out there is some incompatibility between SQLite and Samba. You can find a ton of posts about this if you search on 'sqlite cifs'. It looks like it is a form of file locking which is causing the problem. A full Microsoft client and server do no seem to have this problem. It seems to only occur if either the client or server is running Samba.

I've used the environment variable to move the DB and now the Calibre server updates properly when new books are added. The last step is to backup the metadata DB files now that they are no longer on the NAS.

Hope this helps someone else in the future.
Hi, I am having trouble making this work (having my library hosted on a NAS), and am hoping you can assist me. Calibre is installed to my machine (C:\Program Files\Calibre2), and my eBook files (organized by Calibre in directories with metadata.opf files and cover.jpg files) are stored on a NAS mapped to the N:\ drive.
I edited the calibre-portable.bat file to set the ebook location as follows:
Code:
IF EXIST N:\eBooks (
	SET CALIBRE_LIBRARY_DIRECTORY=N:\eBooks
	ECHO LIBRARY FILES:      N:\eBooks
)
And I set my metadata database location as follows:
Code:
IF EXIST "C:\Documents and Settings\Administrator\Calibre Library\metadata.db" (
	IF NOT "%CALIBRE_LIBRARY_DIRECTORY%" == "C:\Documents and Settings\Administrator\Calibre Library" (
		SET CALIBRE_OVERRIDE_DATABASE_PATH="C:\Documents and Settings\Administrator\Calibre Library\metadata.db"
		ECHO DATABASE:           C:\Documents and Settings\Administrator\Calibre Library\metadata.db
		ECHO '
		ECHO ***CAUTION*** Library Switching will be disabled 
		ECHO '
	)
)
so I have copied my metadata.db file from N:\eBooks (where it normally was) to C:\Documents and Settings\Administrator\Calibre Library.
However, when I launch the calibre-portable.bat file, I get the following error:
Code:
calibre, version 0.9.17
Corrupted database: The library database at N:\eBooks appears to be corrupted. Do you want calibre to try and rebuild it automatically? The rebuild may not be completely successful. If you say No, a new empty calibre library will be created.

Traceback (most recent call last):
  File "site-packages\calibre\gui2\main.py", line 228, in initialize_db
  File "site-packages\calibre\library\database2.py", line 166, in __init__
  File "site-packages\calibre\library\database2.py", line 114, in connect
  File "site-packages\calibre\library\sqlite.py", line 366, in connect
DatabaseException: unable to open database file
	RemoteTraceback (most recent call last):
	  File "site-packages\calibre\library\sqlite.py", line 248, in run
	  File "site-packages\calibre\library\sqlite.py", line 225, in connect
	OperationalError: unable to open database file
Trying to rebuild the library fails, so that will not work, unfortunately. I can confirm that my library is ok though, since I can launch Calibre normally with the metadata.db file that is on the NAS at N:\eBooks (but this takes a very long time, which is why I want to use the local copy of metadata.db).
Am I missing a step?
Thanks for the help!
mwaterbu is offline   Reply With Quote