Connecting to multiple Rails DBs, SQLite3 and SQLServer 2008 -


i’m trying connect sql server called demand using gem: https://github.com/rails-sqlserver/i'm

i'm following recipe #3 book 'rails recipes' http://pragprog.com/book/rr2/rails-recipes

here’s database.yml file:

demand:   adapter: sqlserver   host: 172.21.148.01   port: 1433   database: demand   username: deapp   password: @pp1user   timeout: 5000 

from rails console, when test connection demand.connection following: (i know addy , pw i'm connected via toad currently, created model 'demand' rails have object)

> tinytds::error: login failed user ‘deapp’. > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/tiny_tds-0.5.1/lib/tiny_tds/client.rb:68:in > `connect’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/tiny_tds-0.5.1/lib/tiny_tds/client.rb:68:in > `initialize’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.1.6/lib/active_record/connection_adapters/sqlserver_adapter.rb:400:in > `new’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.1.6/lib/active_record/connection_adapters/sqlserver_adapter.rb:400:in > `connect’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.1.6/lib/active_record/connection_adapters/sqlserver_adapter.rb:198:in > `initialize’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.1.6/lib/active_record/connection_adapters/sqlserver_adapter.rb:35:in `new’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-sqlserver-adapter-3.1.6/lib/active_record/connection_adapters/sqlserver_adapter.rb:35:in `sqlserver_connection’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:304:in > `new_connection’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:323:in > `checkout_new_connection’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:265:in > `block (2 levels) in checkout’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in > `loop’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:261:in > `block in checkout’ > /users/drewgilliam/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in > `mon_synchronize’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:260:in > `checkout’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:162:in > `connection’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:409:in > `retrieve_connection’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in > `retrieve_connection’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:89:in `connection’ (irb):11 > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands/console.rb:45:in > `start’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands/console.rb:8:in > `start’ > /users/drewgilliam/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/commands.rb:40:in > `‘ script/rails:6:in `require’ 

any help? here's pragmatic programmer forum if care answer there well: http://forums.pragprog.com/forums/189/topics/10476

i found out because external db user password started @ symbol, rails wasn't happy because thought , instance variable.

i changed pw not starting wth @ , connected fine.

    drews-macbook-air:de_app drewgilliam$ rails console loading development environment (rails 3.1.3) 1.9.2p290 :001 > externaldb.connection   execute (36.7ms)  use [demandestimator]  => #<activerecord::connectionadapters::sqlserveradapter version: 3.1.6, year: 2008, product_level: "sp1", product_version: "10.50.2500.0", edition: "enterprise edition (64-bit)", connection_options: {:adapter=>"sqlserver", :host=>"172.21.148.01", :port=>1433, :database=>"demandestimator", :username=>"deapp", :password=>"demand_app_user", :timeout=>5000, :mode=>:dblib}>  1.9.2p290 :002 > 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -