quarta-feira, 7 de outubro de 2009

SQLite3::SQLException woes

Yesterday was a long night, trying to find out what was generating a

"SQLite3::SQLException: unable to open database"

in my Vista/Cygwin/Ruby on Rails setup. That error occurred only when trying to modify the database.

After googling a lot I found suggestions to check if both the database file and the directory where it is located have write permissions for the user. That was OK in my setup. I could use the database normally from command line, so the file was not corrupted.

The solution: opening a new cygwin shell executing the "Run as administrator" option and calling Webrick from this shell. Even though I was executing previously from an user that has administration rights that didn't work. It seems that sqlite3 needs to write in some directory, distinct from that where the database file is located, where only the real Administrator can write.

2 comentários:

  1. So the _directory_ needs to be writable, too? That solved it for me. Thanks!

    ResponderExcluir
  2. Kolja, for me it was not sufficient for the directory to be writable too, I needed to call Webrick from an Administrator's shell.

    Seems the directory permission is a necessary condition, but not sufficient - at least for my case.

    ResponderExcluir