2

Ruby version:ruby 2.1.3p242 (2014-09-19 revision 47630) [x64-mingw32]

Rails version:Rails 4.1.6

Windows :win7 64bit

sqlite3-1.3.9-x64-mingw32.gemspec has changed to s.require_paths= ["lib/sqlite3_native"]

sqlite3.dll in Ruby/Bin,and Gemfile's sqlite3 version is same as Gemfile.lock's,rails server is ok,but when visit the website it returns this error:

Could not load 'active_record/connection_adapters/sqlite3_adapter'. Make sure that the adapter in config/database.yml is valid. If you use an adapter other than 'mysql', 'mysql2', 'postgresql' or 'sqlite3' add the necessary adapter gem to the Gemfile.

infos:

activesupport (4.1.6) lib/active_support/dependencies.rb:247:in require'
activesupport (4.1.6) lib/active_support/dependencies.rb:247:inblock in require'
activesupport (4.1.6) lib/active_support/dependencies.rb:232:in load_dependency'
activesupport (4.1.6) lib/active_support/dependencies.rb:247:inrequire'
activerecord (4.1.6) lib/active_record/connection_adapters/sqlite3_adapter.rbin <top (required)>'
activesupport (4.1.6) lib/active_support/dependencies.rb:247:inrequire'
activesupport (4.1.6) lib/active_support/dependencies.rb:247:in block in require'
activesupport (4.1.6) lib/active_support/dependencies.rb:232:inload_dependency'
activesupport (4.1.6) lib/active_support/dependencies.rb:247:in require'
activerecord (4.1.6) lib/active_record/connection_adapters/connection_specification.rb:188:inspec'
activerecord (4.1.6) lib/active_record/connection_handling.rb:50:in establish_connection'
activerecord (4.1.6) lib/active_record/railtie.rb:129:inblock (2 levels) in class:Railtie'
activesupport (4.1.6) lib/active_support/lazy_load_hooks.rb:38:in instance_eval'
activesupport (4.1.6) lib/active_support/lazy_load_hooks.rb:38:inexecute_hook'
activesupport (4.1.6) lib/active_support/lazy_load_hooks.rb:45:in block in run_load_hooks'
activesupport (4.1.6) lib/active_support/lazy_load_hooks.rb:44:ineach'
activesupport (4.1.6) lib/active_support/lazy_load_hooks.rb:44:in run_load_hooks'
activerecord (4.1.6) lib/active_record/base.rb:326:inmodule:ActiveRecord'
activerecord (4.1.6) lib/active_record/base.rb:23:in <top (required)>'
activerecord (4.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:628:inrescue in call'
activerecord (4.1.6) lib/active_record/connection_adapters/abstract/connection_pool.rb:619:in call'
activerecord (4.1.6) lib/active_record/migration.rb:380:incall'
actionpack (4.1.6) lib/action_dispatch/middleware/callbacks.rb:29:in block in call'
activesupport (4.1.6) lib/active_support/callbacks.rb:82:inrun_callbacks'
actionpack (4.1.6) lib/action_dispatch/middleware/callbacks.rb:27:in call'
actionpack (4.1.6) lib/action_dispatch/middleware/reloader.rb:73:incall'
actionpack (4.1.6) lib/action_dispatch/middleware/remote_ip.rb:76:in call'
actionpack (4.1.6) lib/action_dispatch/middleware/debug_exceptions.rb:17:incall'
actionpack (4.1.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in call'
railties (4.1.6) lib/rails/rack/logger.rb:38:incall_app'
railties (4.1.6) lib/rails/rack/logger.rb:20:in block in call'
activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:inblock in tagged'
activesupport (4.1.6) lib/active_support/tagged_logging.rb:26:in tagged'
activesupport (4.1.6) lib/active_support/tagged_logging.rb:68:intagged'
railties (4.1.6) lib/rails/rack/logger.rb:20:in call'
actionpack (4.1.6) lib/action_dispatch/middleware/request_id.rb:21:incall'
rack (1.5.2) lib/rack/methodoverride.rb:21:in call'
rack (1.5.2) lib/rack/runtime.rb:17:incall'
activesupport (4.1.6) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in call'
rack (1.5.2) lib/rack/lock.rb:17:incall'
actionpack (4.1.6) lib/action_dispatch/middleware/static.rb:64:in call'
rack (1.5.2) lib/rack/sendfile.rb:112:incall'
railties (4.1.6) lib/rails/engine.rb:514:in call'
railties (4.1.6) lib/rails/application.rb:144:incall'
rack (1.5.2) lib/rack/lock.rb:17:in call'
rack (1.5.2) lib/rack/content_length.rb:14:incall'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in service'
E:/Tool/Ruby21-x64/lib/ruby/2.1.0/webrick/httpserver.rb:138:inservice'
E:/Tool/Ruby21-x64/lib/ruby/2.1.0/webrick/httpserver.rb:94:in run'
E:/Tool/Ruby21-x64/lib/ruby/2.1.0/webrick/server.rb:295:inblock in start_thread'
sureshprasanna70
  • 1,043
  • 1
  • 10
  • 27
StanWang
  • 21
  • 1
  • 3
  • possible duplicate of [rails sqlite adapter error](http://stackoverflow.com/questions/7371809/rails-sqlite-adapter-error) – Brad Werth Sep 23 '14 at 06:32
  • my gem list only has this: sqlite3 (1.3.9 x64-mingw32) – StanWang Sep 23 '14 at 06:38
  • how about your database.yml (the adapter, in particular)? – Brad Werth Sep 23 '14 at 06:50
  • is also { gem 'sqlite3', '1.3.9' },but I found in sqlite3_adapter.rb there is a line like {gem 'sqlite3', '~> 1.3.6'}, Is this the reason? – StanWang Sep 23 '14 at 07:00
  • No, probably it just mean >1.3.6 version...my sqlite3 is all 1.3.9... – StanWang Sep 23 '14 at 07:35
  • Possible duplicate of [Could not load 'active\_record/connection\_adapters/sqlite3\_adapter'](http://stackoverflow.com/questions/18277968/could-not-load-active-record-connection-adapters-sqlite3-adapter) – mlt May 25 '16 at 20:49

3 Answers3

3

My resolution (Win7 x64) was to uninstall all unnecessary versions of sqlite3. I had 1.3.9, 1.3.10 and 1.3.11 installed, so I removed .9 and .10 and updated my gemfile to use .11.

gem uninstall sqlite3
bundle install

With 1.3.11 I did not need to apply the s.require_paths=["lib/sqlite3_native"] hack that you mentioned.

Kidquick
  • 1,102
  • 12
  • 13
1

I had the same error, same version of the sqlite3 gem installed, and changed that particular gemspec path as well. After looking around for a while I did a simple

gem install sqlite3

on the command line and that fixed the error.

NickLamp
  • 862
  • 5
  • 10
-3

Go to your app's gemfile and edit the sqlite3 gem version to the one you have installed.

gem 'sqlite3', '1.3.9'