问题
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