2009-12-02 38 views
0

我在Windows下使用NetBeans 6.7.1中的Ruby on Rails,並試圖使用SQLite3。SQLite3和Ruby - 未初始化的常量SQLite3 ... API

我已經安裝了sqlite3的,紅寶石的windows版本,我已經放在sqlite3.def,sqlite3.dll和sqlite3.exe在NetBeans6.7.1> ruby​​2> JRuby的1.2.0>斌

當我嘗試運行db:create rake任務時,出現下面顯示的錯誤和跟蹤。

任何人都可以幫忙嗎?

uninitialized constant SQLite3::Driver::Native::Driver::API 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:105:in `const_missing' 
C:/RubyGemsFolder/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/driver/native/driver.rb:76:in `open' 
C:/RubyGemsFolder/gems/sqlite3-ruby-1.2.5-x86-mswin32/lib/sqlite3/database.rb:76:in `initialize' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/sqlite3_adapter.rb:13:in `sqlite3_connection' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in `new_connection' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:in `checkout_new_connection' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in `checkout' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `loop' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in `checkout' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in `checkout' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in `connection' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:in `retrieve_connection' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in `connection' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/databases.rake:43:in `create_database' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rails-2.3.2/lib/tasks/databases.rake:31 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `call' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:617:in `execute' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `each' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:612:in `execute' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:578:in `invoke_with_call_chain' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/1.8/monitor.rb:191:in `mon_synchronize' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:571:in `invoke_with_call_chain' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:564:in `invoke' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2019:in `invoke_task' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `each' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1997:in `top_level' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1991:in `top_level' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1970:in `run' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2036:in `standard_exception_handling' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:1967:in `run' 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:31 
C:/Program Files/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/rake-0.8.3/bin/rake:19:in `load' 
C:\Program Files\NetBeans 6.7.1\ruby2\jruby-1.2.0\bin\rake:19 
Couldn't create database for {"pool"=>5, "adapter"=>"sqlite3", "database"=>"db/development.sqlite3", "timeout"=>5000} 

回答

1

到目前爲止,有不同的Ruby實現,其中之一是JRuby。

NetBeans捆綁了基於Java虛擬機(JVM)並由其支持的JRuby。 SQLite3/Ruby綁定與JVM不兼容,這些需要原始和本地Ruby實現,也稱爲MRI(Matz Ruby Implementation或C Ruby)。

請安裝單獨的Ruby版本,然後將解釋器添加到NetBeans菜單。

你可以找到關於如何使用新的和Rails here

1.8.6或1.9.1的教程,我建議你從here

希望這有助於安裝的安裝程序(發行候選版本1)的1.8.6版本。

+0

感謝路易斯做更改所使用的JDBC-sqlite3的一個數據庫適配器。我會嘗試的! – Loiusa 2009-12-02 12:21:03