2016-04-13 11 views
2

[README.md][1] dosyasında belirtilen her iki ürünü de yeni yükledim. Bir sorgu dizim var ve veritabanına doğrudan localhost'dan bağlanmak istiyorum .. bu mümkün mü?SQL-Server'ı doğrudan çevrimiçi Veritabanlarına bağlama activerecord-sqlserver-adapter

class Timelapse < ActiveRecord::Base 
    establish_connection({ 
    :adapter => "sqlserver", 
    :host  => "myhostname.net", 
    :username => "myusername", 
    :password => "mypassword", 
    :database => "mydbname" 
    }) 
end 

ve ben rails c gitti Timelapse.first yapmaya çalıştım ve bu Gem

SETP kullanarak böyle

TinyTds::Error: Adaptive Server connection failed 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `connect' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/tiny_tds-0.7.0/lib/tiny_tds/client.rb:74:in `initialize' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:311:in `new' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:311:in `dblib_connect' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:302:in `connect' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/connection_adapters/sqlserver_adapter.rb:58:in `initialize' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/sqlserver_base.rb:17:in `new' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-sqlserver-adapter-4.2.10/lib/active_record/sqlserver_base.rb:17:in `sqlserver_connection' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:438:in `new_connection' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:448:in `checkout_new_connection' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:422:in `acquire_connection' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:349:in `block in checkout' 
    from /home/ijunaidfarooq/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:348:in `checkout' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:263:in `block in connection' 
    from /home/ijunaidfarooq/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:262:in `connection' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_adapters/abstract/connection_pool.rb:571:in `retrieve_connection' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:113:in `retrieve_connection' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:87:in `connection' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/querying.rb:39:in `find_by_sql' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/relation.rb:639:in `exec_queries' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/relation.rb:515:in `load' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/relation.rb:243:in `to_a' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.6/lib/active_record/relation.rb:630:in `inspect' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/console.rb:110:in `start' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/console.rb:9:in `start' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:68:in `console' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!' 
    from /home/ijunaidfarooq/.rvm/gems/ruby-2.2.2/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>' 
    from bin/rails:8:in `require' 

cevap

0

Bağlan olan bir hata var: - 'tiny_tds' mücevher gem 'activerecord-sqlserver-adapter'

ve ayrıca ile kontrol edin activerecord-sqlserver-adapter

adım: -2 gelişimi: portu: 1433 modu: DBLIB adaptör: sqlserver konak: dataserver boş olduğunda # kullanılan veritabanı: kullanıcı adı: şifre: zaman aşımı: 0

varsayılan portu: dataserver DBLIB: zaman aşımı: 5000 zaman aşımı: 1433 # default 1433 varsayılan modudur 0 - hayır zaman aşımı olması azure: doğru
dsn: