这是一个创建于 4523 天前的主题,其中的信息可能已经有所发展或是发生改变。
"When a process wants to change a database file (and it is not in WAL mode), it first records the original unchanged database content in a rollback journal. The rollback journal is an ordinary disk file that is always located in the same directory or folder as the database file and has the same name as the database file with the addition of a -journal suffix. The rollback journal also records the initial size of the database so that if the database file grows it can be truncated back to its original size on a rollback."
所以呢, 如果數據文件所在的目錄沒用寫權限, journal文件無法創建, 就無法寫入數據了.
在Python sqlite3 Package中, 會拋出一個頗有誤導性的Error:
OperationalError: unable to open database file
然而真正的錯誤原因並不是無法打開數據文件, 而是無法創建日誌文件.
被這個問題折騰了半天...