8
votes

So in my quest to get a ruby dev environment working, I've ran into an issue that seems...confusing to this ruby noob.

When executing rails server, it starts up as expected, but when you put in localhost:3000 to your standard web browser, it replies the following:

Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile.

Now here's the confusing part. I have sqlite3 installed (the 64 bit version, as that is what I downloaded, and am running a 64 bit OS), as verified by gem query (here's the full list of gems)

Gems

Uninstalling and reisntalling didn't do a lick of good for the issue at hand, but it did install without a hitch. Also the gemfile for the project that I'm testing this with is the folliwing

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'

# Use sqlite3 as the database for Active Record
gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'

# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'

# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'

# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'

# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'

# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'

group :doc do
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', require: false
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# Use unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano', group: :development

# Use debugger
# gem 'debugger', group: [:development, :test]

As you can see, sqlite3 is specified in the Gemfile quite early on, yet for whatever reason when I try to load the main page, it acts like it's not there.

Particulars for this machine are the following that weren't mentioned earlier in the gems section:

Rails 4 Ruby 2 Windows 7

Anyone ever ran into this before?

3
Have you got the sqlite dll in path? - Bala
@bala I had not at the time of your message (assumed when installing the gem it installed all dependencies...shows what assuming gets you), so I downloaded sqlite3.dll from sqlite.org/download.html and placed it in E:\Programs\Ruby200-x64\lib\ruby\gems\2.0.0\gems\sqlite3-1.3.8-x64-mingw32\lib\sqlite3\2.0 (which is part of my path if it includes all subdirectories) with same result. - canadiancreed
could you try after dropping the dll at ruby\bin path. - Bala
@Bala Tried it in ruby/bin, same result. - canadiancreed

3 Answers

20
votes

I just had this issue too. Go into your Gemfile.lock file and search for the 'sqlite3' entry. You'll note it reads sqlite3 (1.3.8-x86-mingw32). Change that to sqlite3 (1.3.8-x64-mingw32) and then run the bundle install command and everything should work like normal.

1
votes

I faced same issue and this seems to be Windows 7 specific Env issue. My problem was resolved with below changes

Go into your Gemfile.lock file and update sqlite3 (1.3.8-x86-mingw32) to sqlite3 (1.3.8-x64-mingw32)

0
votes

Run bundle install from the project directory. That will update Gemfile.lock. You also have to restart the Rails server.

Also see config/database.yml which specifies which gem to use for the database.

development:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000