V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
SQLite
013231
V2EX  ›  SQLite

如果需要寫入數據, 不僅數據文件要有寫入權限, 數據文件所在的目錄也要有寫入權限

  •  
  •   013231 · 2012-06-21 01:15:25 +08:00 · 5223 次点击
    这是一个创建于 4298 天前的主题,其中的信息可能已经有所发展或是发生改变。
    "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
    然而真正的錯誤原因並不是無法打開數據文件, 而是無法創建日誌文件.
    被這個問題折騰了半天...
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3157 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 12:35 · PVG 20:35 · LAX 05:35 · JFK 08:35
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.