2

我下载了 BitNami 的 Jruby。一切正常,但是当我想连接到 SQL Server 2008 时,出现了问题。

database.yml 如下

development:
       adapter: sqlserver
      host: 127.0.0.1
      instanceName: SQLServer2008
      database: truetemp
      username: sa
      password: 7354500

我使用命令“Jruby -S rails generate scaffold Product title:string ....”,ROR 效果很好;但命令“rake db:migrate --trace”失败。

f:\tmp\RubyMine201207>rake db:migrate --trace ** 调用 db:migrate (first_time) ** 调用环境 (first_time) ** 执行环境 ** 调用 db:load_config (first_time) ** 调用 rails_env (first_time) ** 执行 rails_env ** 执行 db:load_config rake 中止!请安装 sqlserver 适配器:(gem install activerecord-sqlserver-adapte r没有要加载的文件 -- active_record/connection_adapters/sqlserver_adapter)

org/jruby/RubyKernel.java:1033:inrequire' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activesupport-3 .2.1/lib/active_support/dependencies.rb:251:in需要'F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activesupport-3 .2.1/lib/active_support/dependencies.rb:236:在load_dependency' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activesupport-3 .2.1/lib/active_support/dependencies.rb:251:in需要'F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activerecord-3。2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:4 8:in resolve_hash_connection' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activerecord-3. 2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:3 9:inresolve_string_connection' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activerecord-3。2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:2 3:在spec' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activerecord-3. 2.1/lib/active_record/connection_adapters/abstract/connection_specification.rb:1 27:in建立连接'F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activerecord-3。2.1/lib/active_record/railtie.rb:76:inRailtie' org/jruby/RubyKernel.java:2045:ininstance_eval' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activesupport-3 .2.1/lib/active_support/lazy_load_hooks.rb:36:in execute_hook' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activesupport-3 .2.1/lib/active_support/lazy_load_hooks.rb:43:inrun_load_hooks' org/jruby/RubyArray.java: 1615:在each' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activesupport-3 .2.1/lib/active_support/lazy_load_hooks.rb:42:inrun_load_hooks 的 F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activerecord-3 中。2.1/lib/active_record/base.rb:716:in (root)' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/activerecord-3. 2.1/lib/active_record/base.rb:6:in(root)' org/jruby/RubyProc.java:270:in call' org/jruby/RubyProc.java:220:in call' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems /rake-0.9.2.2/lib/rake/task.rb:205:in execute' org/jruby/RubyArray.java:1615:in each' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib /rake/task.rb:200:in execute' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/li b/rake/task.rb:158:ininvoke_with_call_chain' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/1.8/monitor.rb:191:inmon_sy nchronize' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/li b/rake/task.rb:151:ininvoke_with_call_chain' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:176:in invoke_prerequisites' org/jruby/RubyArray.java:1615:ineach' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:174:in invoke_prerequisites' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/li b/rake/task.rb:157:ininvoke_with_call_chain' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/1.8 /monitor.rb:191:in mon_sy nchronize' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/li b/rake/task.rb:151:ininvoke_with_call_chain' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/task.rb:144:in invoke' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/li b/rake/application.rb:116:ininvoke_task ' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:in top_level' org/jruby/RubyArray.java:1615:ineach' F:/Program Files/BitNami JRubyStack /jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:94:intop_level' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/li b/rake/application.rb:133:instandard_exception_handling' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:88:in top_level' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/li b/rake/application.rb:66:inrun' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems/1.8/gems/rake-0.9.2.2/li b/rake/application.rb:63:inrun' F:/Program Files/BitNami JRubyStack/jruby/lib/ruby/gems /1.8/gems/rake-0.9.2.2/bi n/rake:33:in (root)' org/jruby/RubyKernel.java:1058:inload' F:/Program Files/BitNami JRubyStack/jruby/bin/rake:23:in `(root)' 任务:TOP => db :migrate => db:load_config

4

1 回答 1

1

确保将以下行添加到您的Gemfile

gem 'activerecord-sqlserver-adapter'

于 2012-07-14T07:29:39.277 回答