satya on rails
satya on rails

Reputation: 392

ActiveRecord::ConnectionNotEstablished error when upgrading to

I tried to upgrade an existing project from Rails 3.2.3 to Rails 4.1.4(the latest). I updated my gemfile and had no problems updating the bundle. I also added

config.eager_load = false

to my environment *.rb. When I run the server I get the following error when I try to access the first page… It looks like no connection to database but I can use a client to access it. My service currently uses sqlite3..

ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished): activerecord (4.1.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in retrieve_connection' activerecord (4.1.4) lib/active_record/connection_handling.rb:113:inretrieve_connection' activerecord (4.1.4) lib/active_record/connection_handling.rb:87:in connection' activerecord (4.1.4) lib/active_record/query_cache.rb:51:inrestore_query_cache_settings' activerecord (4.1.4) lib/active_record/query_cache.rb:43:in rescue in call' activerecord (4.1.4) lib/active_record/query_cache.rb:32:incall' activerecord (4.1.4) lib/active_record/connection_adapters/abstract/connection_pool.rb:621:in call' actionpack (4.1.4) lib/action_dispatch/middleware/callbacks.rb:29:inblock in call' activesupport (4.1.4) lib/active_support/callbacks.rb:82:in `run_callbacks' (1.5.2) li

b/rack/runtime.rb:17:in `call' …

My database.yml file did not change. It uses sqlite3

# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
development:
  adapter: sqlite3
  database: db/development.sqlite3
  pool: 5
  timeout: 5000

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  adapter: sqlite3
  database: db/test.sqlite3
  pool: 5
  timeout: 5000

production:
  adapter: sqlite3
  database: db/production.sqlite3
  pool: 5
  timeout: 5000

Upvotes: 1

Views: 2737

Answers (1)

satya on rails
satya on rails

Reputation: 392

It turns out that when migrating from 3.2 to 4.0 there are quite a few changes to apply to the configuration files. You can see the details in the link below, I was able to solve the problem using postgres instead of sqlite and running the command suggested by the link

rake rails:update

Upgrading to rails 4.0 from 3.2

Upvotes: 4

Related Questions