Re: database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)

4,759 views
Skip to first unread message

Marc Joffe

unread,
Sep 29, 2013, 10:54:09 AM9/29/13
to phusion-...@googlegroups.com
Check your virtualhost configuration and make sure that you're pointing at the correct environment.

On Sunday, September 29, 2013 8:12:22 AM UTC-4, Lenin Raj Rajasekaran wrote:
Passenger Version : 4.0.5
Ruby: ruby 2.0.0p195 (2013-05-14 revision 40734) [x86_64-linux]
Rails: Rails 4.0.0

I have created a new application. It works fine in development mode using Passenger, but throws the error 

database configuration does not specify adapter (ActiveRecord::AdapterNotSpecified)
 
/usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:52:in `resolve_hash_connection'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:
46:in `resolve_string_connection'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0/lib/active_record/connection_adapters/connection_specification.rb:
30:in `spec'
 
/usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0/lib/active_record/connection_handling.rb:39:in `establish_connection'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0/lib/active_record/railtie.rb:
175:in `block (2 levels) in <class:Railtie>'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:
38:in `instance_eval'
 
/usr/local/rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:
45:in `block in run_load_hooks'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:
44:in `each'
 
/usr/local/rvm/gems/ruby-2.0.0-p195/gems/activesupport-4.0.0/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0/lib/active_record/base.rb:
322:in `<module:ActiveRecord>'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/activerecord-4.0.0/lib/active_record/base.rb:
22:in `<top (required)>'
 
/usr/local/rvm/gems/ruby-2.0.0-p195/gems/passenger-4.0.5/lib/phusion_passenger/loader_shared_helpers.rb:295:in `before_handling_requests'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:
105:in `negotiate_spawn_command'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:
129:in `<module:App>'
 
/usr/local/rvm/gems/ruby-2.0.0-p195/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:6:in `<module:PhusionPassenger>'
  /usr/local/rvm/gems/ruby-2.0.0-p195/gems/passenger-4.0.5/helper-scripts/rack-preloader.rb:
5:in `<main>'


when running in Production mode..

But application works fine in WEBrick server in both development and production

My production and development config are exactly same.





# MySQL.  Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
#   gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
#   gem 'mysql2'
#
# And be sure to use new-style password hashing:
#   http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development
:
  adapter
: mysql2
  encoding
: utf8
  database
: mysample
  pool
: 5
  username
: mysample
  password
: mysample
  socket
: /var/run/mysqld/mysqld.sock


# 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
: mysql2
  encoding
: utf8
  database
: mysample
  pool
: 5
  username
: mysample
  password
: mysample
  socket
: /var/run/mysqld/mysqld.sock


production
:
  adapter
: mysql2
  encoding
: utf8
  database
: mysample
  pool
: 5
  username
: mysample
  password
: mysample
  socket
: /var/run/mysqld/mysqld.sock


Any pointers?

Hongli Lai

unread,
Oct 1, 2013, 5:36:56 AM10/1/13
to phusion-passenger
Your RailsEnv should be "production" with lowercase p. You wrote an uppercase P.

On Tue, Oct 1, 2013 at 10:08 AM, Lenin Raj Rajasekaran
<email...@gmail.com> wrote:
> Hi Marc,
>
> This is my current virtual host configuration:
>
>
> <VirtualHost *:80>
> ServerAdmin webmaster@localhost
> ServerName duggout.emaillenin.com
> DocumentRoot /var/emaillenin/rails/dugout/public/
> RailsEnv Production
> # RailsEnv development
>
> With this configuration, I get the error apapter error. When I uncomment
> RailsEnv development and comment RailsEnv Production and restart apache, the
> site works fine. The problem is when I switch from development to
> production.
> --
> You received this message because you are subscribed to the Google Groups
> "Phusion Passenger Discussions" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to phusion-passen...@googlegroups.com.
> To post to this group, send email to phusion-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/phusion-passenger.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Phusion | Ruby & Rails deployment, scaling and tuning solutions

Web: http://www.phusion.nl/
E-mail: in...@phusion.nl
Chamber of commerce no: 08173483 (The Netherlands)

Marc Joffe

unread,
Oct 2, 2013, 10:10:32 AM10/2/13
to phusion-...@googlegroups.com
Hi Lenin,

Did you make the fix that Hongli pointed out? That should get you going. Are you up and running?
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages