Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rails sqlite adapter error

I'm following the instructions in rails tutorial and got stuck when trying to use the scaffold command.

When running:

rails generate scaffold User name:string email:string  

I get the error:

C:/RailsInstaller/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/activerecord-3.1.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:71:in `rescue in establish_connection': Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (can't activate sqlite3 (~> 1.3.4), already activated sqlite3-1.3.3-x86-mingw32. Make sure all dependencies are added to Gemfile.) (RuntimeError)

Running:

gem install activerecord-sqlite3-adapter

I got the error:

ERROR:  Could not find a valid gem 'activerecord-sqlite3-adapter' (>= 0) in any repository
ERROR:  Possible alternatives: activerecord-jdbcsqlite3-adapter, activerecord-sqlserver-adapter, activerecord-nulldb-adapter, activerecord-spatialite-adapter, activerecord-simpledb-adapter

My Gemfile looks like this:

source 'http://rubygems.org'
gem 'rails', '3.1.0'  
gem 'sqlite3', '1.3.3'  
...

I'm running on Windows 7 x64 OS.

Any ideas?

like image 943
Ohad Horesh Avatar asked Sep 10 '11 12:09

Ohad Horesh


2 Answers

Ok I found the problem. I noticed that my Rails installation has both SQLite 1.3.3 and 1.3.4 I changed my Gemfile from:

gem 'sqlite3', '1.3.3'

to:

gem 'sqlite3', '1.3.4'

That solved the problem. Thanks @holger-just for pointing me to the relevant line in the error message in their answer.

like image 120
Ohad Horesh Avatar answered Oct 21 '22 07:10

Ohad Horesh


suggested install command:

gem install activerecord-jdbc-sqlite3-adapter

actual install command:

gem install activerecord-jdbcsqlite3-adapter

Reference: http://kenai.com/jira/browse/ACTIVERECORD_JDBC-19

like image 32
jduyan Avatar answered Oct 21 '22 07:10

jduyan