I access a Db on a server externally. My scripts worked before, but they
do not work on the new server. I’m quite new to this and wondered where
I am going wrong.
The error I have is:
Mysql::Error: Lost connection to MySQL server during query: SET NAMES
‘utf8’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/abstract_adapter.rb:120:in `log’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/mysql_adapter.rb:184:in `execute’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/mysql_adapter.rb:331:in `connect’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/mysql_adapter.rb:87:in `initialize’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/mysql_adapter.rb:36:in `new’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/mysql_adapter.rb:36:in `mysql_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:251:in `send’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:251:in
`connection_without_query_cache=’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/query_c
ache.rb:54:in `connection=’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:220:in
`retrieve_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:78:in `connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb
:1278:in `sanitize_sql’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb
:1278:in `collect’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb
:1278:in `sanitize_sql’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb
:1062:in `add_conditions!’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb
:1012:in `construct_finder_sql’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb
:924:in `find_every’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/base.rb
:381:in `find’
#{RAILS_ROOT}/app/controllers/login_controller.rb:226:in
`set_session_initial’
#{RAILS_ROOT}/app/controllers/login_controller.rb:24:in `login’
-e:4:in `load’
-e:4
The code causing the problem is:
def set_session_initial
session[:content]=Content.find(:all, :order => “identity”, :conditions
=>
[“language_id”, session[:language_id]])
session[:user_id] = nil
session[:districts]=District.find(:all, :order =>
“district_name”).map{|u|
[u.district_name, u.id]}
session[:languages]=Language.find(:all, :order =>
“language_name”).map{|u|
[u.language_name, u.id]}
end
Does anyone have an idea why this is not working? The database and
tables are in UTF 8.
Thanks
Darren