I am using Ruby on Rails in NetBeans 6.7.1 under windows, and I'm trying to use SQLite3.
I've installed the windows version of sqlite3-ruby, and I've placed sqlite3.def, sqlite3.dll and sqlite3.exe in NetBeans6.7.1>ruby2>jruby-1.2.0>bin
When I try to run the db:create rake task, I get the error and trace shown below.
Can anyone help please?
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}
You could also change the database adapter you are using to the jdbc-sqlite3 one by installing the jdbc equivalents(jdbc-sqlite3
activerecord-jdbcsqlite3-adapter
), which you should be able to do from netbeans gem manager
To date, there are different Ruby implementations, one of those is JRuby.
NetBeans bundles JRuby, which is based and powered by Java Virtual Machine (JVM).
SQLite3/Ruby bindings are not compatible with JVM, these needs the original and native Ruby implementation, also known as MRI (Matz Ruby Implementation or C Ruby).
Please install a separate Ruby version and then add the interpreter to NetBeans menu.
You can find tutorials on using newer 1.8.6 or 1.9.1 with Rails here
I recommend you install version 1.8.6 of the installer (Release Candidate 1) from here
Hope this helps.
精彩评论