Sqlite3 no longer found after upgrading to Rails 2.2 on MacOS

I've updated to the Rails 2.2 gem and now I can't run Rails because I get an error it cannot find SQLite3. I was running just fine under 2.1.2 with SQlite3. I'm on a Mac OS X 10.5 (Leopard) system.

gem list rails

rails (2.2.2, 2.1.2, 2.0.2) rails-app-installer (0.2.0)

gem list sqlite

sqlite3-ruby (1.2.4)

which sqlite3

/usr/bin/sqlite3

I know SQLite is installed and working because I can go into it from the command line. For some reason though Rails is not able to find it. Any ideas on how to fix this? (I've already tried reinstalling sqlite3-ruby - sudo gem install sqlite3-ruby, but that doesn't help).

RubyGems Environment:   - RUBYGEMS VERSION: 1.3.1   - RUBY VERSION: 1.8.6 (2008-03-03 patchlevel 114) [universal- darwin9.0]   - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8   - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/ Versions/1.8/usr/bin/ruby   - EXECUTABLE DIRECTORY: /usr/bin   - RUBYGEMS PLATFORMS:     - ruby     - universal-darwin-9   - GEM PATHS:      - /Library/Ruby/Gems/1.8      - /Users/nicholas/.gem/ruby/1.8      - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ ruby/gems/1.8   - GEM CONFIGURATION:      - :update_sources => true      - :verbose => true      - :benchmark => false      - :backtrace => false      - :bulk_threshold => 1000      - :sources => ["http://gems.rubyforge.org", "http:// gems.github.com"]   - REMOTE SOURCES:      - http://gems.rubyforge.org      - http://gems.github.com

Faenglir:testapp nicholas$ script/server => Booting Mongrel (use 'script/server webrick' to force WEBrick) => Rails 2.2.2 application starting on http://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server ** Starting Mongrel listening at 0.0.0.0:3000 ** Starting Rails with development environment... ** Rails loaded. ** Loading any Rails specific GemPlugins ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart). ** Rails signals registered. HUP => reload (without restart). It might not work well. ** Mongrel 1.1.5 available at 0.0.0.0:3000 ** Use CTRL-C to stop.

Processing Rails::InfoController#properties (for 127.0.0.1 at 2008-11-22 08:44:20) [GET]

Processing Rails::InfoController#properties (for 127.0.0.1 at 2008-11-22 08:44:21) [GET]

MissingSourceFile (no such file to load -- sqlite3):     /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'     /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:153:in `require'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:521:in `new_constants_in'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:153:in `require'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ core_ext/kernel/requires.rb:7:in `require_library_or_gem'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ core_ext/kernel/reporting.rb:11:in `silence_warnings'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ core_ext/kernel/requires.rb:5:in `require_library_or_gem'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/sqlite3_adapter.rb:10:in `sqlite3_connection'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_pool.rb:223:in `send'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_pool.rb:223:in `new_connection'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_pool.rb:188:in `checkout'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_pool.rb:184:in `loop'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_pool.rb:184:in `checkout'     /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ ruby/1.8/monitor.rb:242:in `synchronize'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_pool.rb:183:in `checkout'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_pool.rb:98:in `connection'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:121:in `retrieve_connection'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ connection_adapters/abstract/connection_specification.rb:113:in `connection'     /Library/Ruby/Gems/1.8/gems/activerecord-2.2.2/lib/active_record/ query_cache.rb:8:in `cache'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ caching/sql_cache.rb:12:in `perform_action'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:524:in `send'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:524:in `process_without_filters'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ filters.rb:606:in `process_without_session_management_support'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ session_management.rb:134:in `process'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ base.rb:392:in `process'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:183:in `handle_request'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:110:in `dispatch_unlocked'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:123:in `dispatch'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:122:in `synchronize'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:122:in `dispatch'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:132:in `dispatch_cgi'     /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/action_controller/ dispatcher.rb:39:in `dispatch'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ rails.rb:76:in `process'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ rails.rb:74:in `synchronize'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ rails.rb:74:in `process'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:282:in `run'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:281:in `each'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/ configurator.rb:281:in `run'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb: 212:in `run'     /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:142:in `load_without_new_constant_marking'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:142:in `load'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:521:in `new_constants_in'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:142:in `load'     /Library/Ruby/Gems/1.8/gems/rails-2.2.2/lib/commands/servers/ mongrel.rb:64     /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'     /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:153:in `require'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:521:in `new_constants_in'     /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/ dependencies.rb:153:in `require'     /Library/Ruby/Gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49     /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'     /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'     script/server:3

Rendered /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/templates/rescues/_trace (27.5ms) Rendered /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/templates/rescues/_request_and_response (0.6ms) Rendering /Library/Ruby/Gems/1.8/gems/actionpack-2.2.2/lib/ action_controller/templates/rescues/layout.erb (internal_server_error)

Ok - I found out what it was ... damn Merb!!

    do_sqlite3-0.9.7

After I removed this gem (which is a dependency installed by Merb) everything went back to working right. I reinstalled the gem, and I get the same error again. So there's something going on between Rails and this particular gem - although I'm not smart enough to figure out what, nor have time to.

So if you're running into the same issue I would just take out that gem - but it probably means you can't use SQLite with your Merb applications. I have to wonder if this was done on purpose as a sort of sabotage, since there is this religious war going on with Merb and Rails.

<< I have to wonder if this was done on purpose as a sort of sabotage, since there is this religious war going on with Merb and Rails. >>

Wow, that's some serious accusations there.

First off, DataMapper is not developed by the Merb team. do_sqlite3 is a separate driver letting you use DM and Sqlite3. In the Rails world, ActiveRecord deals with the various drivers by knowing a lot about them and their APIs. In the DataMapper world, the drivers were re written to match the DataObject API (so DM doesn't have to figure out how each adapter/driver works).

If the problem you're having can be reproduced that means few things. First, you wouldn't be able to use ActiveRecord/Rails and DataMapper on the same system using Sqlite3. DataMapper is used by other frameworks/scripts than Merb and some people even hack Rails to use DM. Secondly ActiveRecord nor DM should touch sqlite3 so it seems pretty strange. On windows, both frameworks do require a sqlite3.dll to be available on the system and they might fight over which version to use but you seem to be on MacOSX.

Regarding the "religious war" you are referring to, I don't know why you say that. As a Merb team member I can assure you that there is not such a thing. We do not agree on the way Rails does few things, but there is no war. And it is certainly not something personal. As mentioned before, we have a lot of respect for DHH and the rest of the Rails team. Without them, I wouldn't do what I do now and Merb would not even exist. So, please don't mention some crazy sabotage theories and maybe people will stop thinking that there is a war going on.

Finally, while I was replying to your messages, I installed Rails 2.2.2, upgraded mongrel to 1.1.5 and made sure I was on DM 0.9.7 with do_sqlite3 0.9.7 and I can't reproduce your problem.

If you upload a test app, I'd be glad to look at it and try to figure out what's going on.

Thanks,

-Matt

My bad, akita from AkitaOnRails.com told me how to reproduce the problem.

1. generate a new app 2. rake db:migrate

Fails

I'll look into it or get someone to look into it.

- Matt

Alright, so after few minutes working with some of the Rails guys and some other Ruby experts like Evan Phoenix, we found the problem. The source is that do_sqlite3 ships with a windows dll called sqlite3.dll and that Ruby was trying to load this file instead of the proper lib.

Libs should be properly namespaced but in this case, that's really a DM/do problem and I believe it should be fixed relatively soon.

Thanks for reporting the bug tho.

-Matt

I had this problem as well. I can confirm that do_sqlite3 has been fixed and I am no longer having this problem.

To fix: just make sure your do_sqlite3 is at 0.9.9, and uninstall all the old versions of do_sqlite3.

Thanks, Scott. I’m really very new at rails; could you tell me exactly what I need to do to replace do_sqlite3? I don’t see it in the list of installed gems.

Thanks,

JIm

Regarding the "religious war" you are referring to, I don't know why you say that. As a Merb team member I can assure you that there is not such a thing. We do not agree on the way Rails does few things, but there is no war. And it is certainly not something personal. As mentioned before, we have a lot of respect for DHH and the rest of the Rails team. Without them, I wouldn't do what I do now and Merb would not even exist. So, please don't mention some crazy sabotage theories and maybe people will stop thinking that there is a war going on.

After all, aren't they going to merge in Rails 3? :slight_smile:

Cheers, Sazima