Action Controller: Exception caught


#1

Hi, I’m running the cookbook example from ONLamp.com. I have tried to
test my site and it comes up with the the message on the site:

ActiveRecord::StatementInvalid in RecipeController#index

Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS
FROM recipes

RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in
log' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:185:inexecute’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:293:in
columns' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:696:incolumns’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:213:in
column_for' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:135:incalculate’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:64:in
count' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:172:incount_collection_for_pagination’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:196:in
paginator_and_collection_for' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:129:inpaginate’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/scaffolding.rb:109:in
list' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/scaffolding.rb:97:inindex’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in
send' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:inperform_action_without_filters’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
perform_action_without_benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
measure' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
perform_action' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
process_without_filters' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:inprocess_without_session_management_support’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
process' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:indispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in
handle_dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:inservice’
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:94:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in each' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:instart’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in
dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire__’
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require__' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require’
script/server:3

c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/abstract_adapter.rb:120:in
log' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:185:inexecute’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:293:in
columns' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:696:incolumns’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:213:in
column_for' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:135:incalculate’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/calculations.rb:64:in
count' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:172:incount_collection_for_pagination’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:196:in
paginator_and_collection_for' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/pagination.rb:129:inpaginate’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/scaffolding.rb:109:in
list' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/scaffolding.rb:97:inindex’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:in
send' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:910:inperform_action_without_filters’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:368:in
perform_action_without_benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:in
measure' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/benchmarking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/rescue.rb:82:in
perform_action' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/base.rb:381:in
process_without_filters' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/filters.rb:377:inprocess_without_session_management_support’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/session_management.rb:117:in
process' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:indispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:in
handle_dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:inservice’
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
c:/ruby/lib/ruby/1.8/webrick/server.rb:155:in start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:94:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in each' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:instart’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:in
dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire__’
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require__' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
`require’
script/server:3

Request

Parameters: None

Show session dump


flash: !ruby/hash:ActionController::Flash::FlashHash {}

Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}

Anyone got any ideas how to fix this? I have tried restarting the server
but that doesnt work.


#2

Fido Gesiwuj wrote:

ActiveRecord::StatementInvalid in RecipeController#index

Mysql::Error: Lost connection to MySQL server during query: SHOW FIELDS
FROM recipes

Get the native mysql drivers for your Windows machine at:
http://www.vandomburg.net/pages/mysql-ruby-windows

That fixed it for me on my XP boxes. If you’re using 2k, by any chance,
I still haven’t been able to fix that.


#3

Does it matter that I’m connecting to a computer from my paid host? I
have changed the config.yml thing.


#4

Oh, now it has another message:

Mysql::Error in RecipeController#index

Access denied for user ‘gesnet’@‘82.163.144.137’ to database ‘cookbook’


#5

Fido Gesiwuj wrote:

Oh, now it has another message:

Mysql::Error in RecipeController#index

Access denied for user ‘gesnet’@‘82.163.144.137’ to database ‘cookbook’

Looks like now you need to set up permissions or lower your firewall on
your db server.


#6

Looks like now you need to set up permissions or lower your firewall on
your db server.

I’ve set the database up to accept connections from my IP (although I
guess that my router’s firewall will be something to do with this).


#7

Bryan D. wrote:

Get the native mysql drivers for your Windows machine at:
http://www.vandomburg.net/pages/mysql-ruby-windows

That fixed it for me on my XP boxes. If you’re using 2k, by any chance,
I still haven’t been able to fix that.

I’m the maintainer of that distribution and am currently investigating
the segfaults on Windows 2000. If you’re interested in testing out a
release that should fix that, drop me a note.


#8

Fido Gesiwuj wrote:

Looks like now you need to set up permissions or lower your firewall on
your db server.

I’ve set the database up to accept connections from my IP (although I
guess that my router’s firewall will be something to do with this).

You have to grant privileges to the user you want to access the server
at that ip, or at least at ‘%’. If you don’t do that, mysql will tell
you that you’re not authorized.