0
私は、VirtualBoxでUbuntu 11.10のvmを実行しているWindows 7マシンを持っています。私のWindows 7マシンには、SQL Server 2008がインストールされています。これは、レール3.2とtiny_tds gemを使用して私のUbuntu VMからアクセスしようとしています。tinytdsを使ってRails 3.2のUbuntu VMからSQL Serverに接続する
私は私のRailsアプリケーションを起動しようとすると、私は、次を得る:
/home/user/.rvm/gems/ruby-1.9.3-p0/gems/tiny_tds-0.5.1/lib/tiny_tds/client.rb:68:in `connect': Unable to open socket (TinyTds::Error)
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/tiny_tds-0.5.1/lib/tiny_tds/client.rb:68:in `initialize'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-sqlserver-adapter-3.2.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:415:in `new'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-sqlserver-adapter-3.2.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:415:in `connect'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-sqlserver-adapter-3.2.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:203:in `initialize'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-sqlserver-adapter-3.2.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:40:in `new'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-sqlserver-adapter-3.2.0/lib/active_record/connection_adapters/sqlserver_adapter.rb:40:in `sqlserver_connection'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:277:in `new_connection'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:287:in `checkout_new_connection'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:235:in `block (2 levels) in checkout'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `loop'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:230:in `block in checkout'
from /home/user/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:229:in `checkout'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:95:in `connection'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_connection'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:168:in `retrieve_connection'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:142:in `connection'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/model_schema.rb:308:in `clear_cache!'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activerecord-3.2.1/lib/active_record/railtie.rb:91:in `block (2 levels) in <class:Railtie>'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:418:in `_run__855141609__prepare__585695355__callbacks'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405:in `__run_callback'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.1/lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/actionpack-3.2.1/lib/action_dispatch/middleware/reloader.rb:48:in `prepare!'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/application/finisher.rb:47:in `block in <module:Finisher>'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /home/user/RubymineProjects/myapp/config/environment.rb:5:in `<top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from /home/user/RubymineProjects/myapp/config.ru:4:in `block in <main>'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /home/user/RubymineProjects/myapp/config.ru:1:in `new'
from /home/user/RubymineProjects/myapp/config.ru:1:in `<main>'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:46:in `app'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands/server.rb:70:in `start'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:55:in `block in <top (required)>'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap'
from /home/user/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
私は、SQL Serverがポート1433上で私のホストIPへのtelnetを実行して、VMにアクセス可能であると私はにできる午前ことを確認することができます私はルビーやTinyTds経由で接続することはできません。私のVM用ネットワークアダプタはNATを使用しています。さらに、Windowsマシンから同じレールアプリケーションを実行すると、SQL Serverに接続できます。 SQL ServerではTCP/IP接続が有効になっています。
どうやってやったのですか?コード? – brabertaser19
yamlの設定で、 'dataserver'の設定を' host'に変更しました。 –