SQLite3::NotADatabaseException (file is encrypted or is not a database) in production (Engineyard)

一笑奈何 提交于 2019-12-11 16:28:15

问题


I am trying to parse a sqlite3 database in rails 3 (using sqlite3-ruby gem). The database to parse is coming from a file upload. Here is my controller code:

  require 'fileutils'
  require 'sqlite3'

  tmp = params[:file_upload][:my_file]
  file = params[:file_upload][:my_file].tempfile
  filename = params[:file_upload][:my_file].original_filename

  file = File.join("public", params[:file_upload][:my_file].original_filename)
  FileUtils.cp tmp.path, filename

  db = SQLite3::Database.new(filename)

So it works very well in local, but not in production (with EngineYard). I get the following error:

 SQLite3::NotADatabaseException (file is encrypted or is not a database)

I do not understand why. Any help would be very appreciated, because i really don't know how to solve this thing.

Thanks


回答1:


According to your own question Sqlite 3.7 on amazon ec2 with Engine Yard it seems :) Engine Yard provided you with sqlite 3.6, meaning that @schlenk above gave the right answer: The error message typically indicates that the database file was created with WAL mode, which requires mysql 3.7, which Engine Yard do not yet offer.



来源:https://stackoverflow.com/questions/12656588/sqlite3notadatabaseexception-file-is-encrypted-or-is-not-a-database-in-produ

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!