2016-04-13 31 views
2

私は[README.md][1]ファイルに記載されている両方の宝石をインストールしました。私はクエリ文字列を持っていて、私はlocalhostからデータベースに直接接続したいです..それは可能ですか?SQL-Serverを直接オンラインデータベースに接続するactiverecord-sqlserver-adapter

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

と私はTimelapse.firstを実行しようとしましたし、これらの宝石

SETP使用することで、このような接続

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' 

答えて

0

あるエラーだrails cに行ってきました: - 1 宝石 'tiny_tds' をgem 'activerecord-sqlserver-adapter'

また、gitで確認してくださいactiverecord-sqlserver-adapter

ステップ:-2 開発: ポート:1433 モード: アダプタDBLIB:SQLServerの ホスト: ユーザー名:: パスワード: タイムアウト:0

デフォルト#はデータサーバが空白の データベースを使用 ポート:DBLIB データサーバ: タイムアウト:5000 タイムアウト:1433#デフォルトは1433 デフォルト モードです0 - タイムアウトを持たないために azure:true
dsn:

関連する問題