Ezra Wolfe on 29 May 2008 14:26:51 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PhillyOnRails] ODBC help needed


Title: ODBC help needed

Hi all,

I am deploying a RoR app on a Windows 2003 server. It uses two databases, MySql and SQL Server. The MySQL connection is fine. The SQL Server connection fails.

I am fairly confident the application code is OK because I have it deployed to a separate XP staging server and it works great. I am now deploying to our production server and I get the following errors (see below). I think it must be a configuration issue, but I can't locate it.

I've spent a lot of time with Google and haven't come up with anything that seems to help.

The DSN is set up and the test connection works fine.

The connection data is in a .rb file and looks like this:

class AmeObject < ActiveRecord::Base
end
AmeObject.establish_connection(:adapter => "sqlserver",
                                :mode => "odbc",
                                :dsn => "XXXXX",
                                :database => "XXXXX",
                                :username => "XXXXXX",
                                :password => "XXXXX")

Anyone have any tips or ideas?

A DBI::DatabaseError occurred in account#login:

  IM002 (0) [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
  C:/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:95:in `connect'

-------------------------------
Backtrace:
-------------------------------

  C:/ruby/lib/ruby/site_ruby/1.8/DBD/ODBC/ODBC.rb:95:in `connect'
  C:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:424:in `connect'
  C:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:215:in `connect'
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/connection_adapters/sqlserver_adapter.rb:41:in `sqlserver_connection'

  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `send'

  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:251:in `connection_without_query_cache='

  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/query_cache.rb:54:in `connection='
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:220:in `retrieve_connection'

  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection'

  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb:696:in `columns'
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb:709:in `column_names'
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb:722:in `column_methods_hash'
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb:1158:in `all_attributes_exists?'
  [RAILS_ROOT]/vendor/rails/activesupport/lib/active_support/dependencies.rb:140:in `all?'
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb:1158:in `each'
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb:1158:in `all?'
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb:1158:in `all_attributes_exists?'
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/base.rb:1095:in `method_missing'
  [RAILS_ROOT]/app/models/user.rb:487:in `update_region'
  [RAILS_ROOT]/app/models/user.rb:453:in `save_without_validation'
  [RAILS_ROOT]/vendor/rails/activerecord/lib/active_record/validations.rb:724:in `save_with_validation'
  [RAILS_ROOT]/app/models/user.rb:474:in `save_with_validation'
  [RAILS_ROOT]/app/controllers/account_controller.rb:17:in `login'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:910:in `send'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:910:in `perform_action_without_filters'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:368:in `perform_action_without_benchmark'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
  C:/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/rescue.rb:82:in `perform_action'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:381:in `send'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/base.rb:381:in `process_without_filters'
  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/filters.rb:377:in `process_without_session_management_support'

  [RAILS_ROOT]/vendor/rails/actionpack/lib/action_controller/session_management.rb:117:in `process'
  [RAILS_ROOT]/vendor/rails/railties/lib/dispatcher.rb:38:in `dispatch'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/rails.rb:76:in `process'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/rails.rb:74:in `synchronize'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/rails.rb:74:in `process'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:159:in `process_client'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:158:in `each'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:158:in `process_client'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in `run'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in `initialize'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in `new'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:285:in `run'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:268:in `initialize'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:268:in `new'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel.rb:268:in `run'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/configurator.rb:282:in `run'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/configurator.rb:281:in `each'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/configurator.rb:281:in `run'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/mongrel_rails:128:in `run'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/lib/mongrel/command.rb:212:in `run'
  C:/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.4-x86-mswin32-60/bin/mongrel_rails:281
  C:/ruby/bin/mongrel_rails:16:in `load'
  C:/ruby/bin/mongrel_rails:16




Regards,
Ezra Wolfe
DLC Solutions
3701 Market Street, Suite 462
Philadelphia, Pa 19104
Mobile: 215.868.5336
Office: 215.966.6177
Fax: 703.935.5594
AIM: ezrawolfe
Skype: ezra.wolfe
www.dlc-solutions.com


_______________________________________________
To unsubscribe or change your settings, visit:
http://lists.phillyonrails.org/mailman/listinfo/talk