3
votes

I tried to use SQLite databse for my jruby project.

When i tried to install sqlite3 gem getting the following error

C:\tibbr\main\community_manager>gem install sqlite3-ruby

Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension.

C:/tibbr/main/tools/jruby/bin/jruby.exe extconf.rb WARNING: JRuby does not support native extensions or the mkmf' library. Check http://kenai.com/projects/jruby/pages/Home for alternatives. extconf.rb:10: undefined methoddir_config' for main:Object (NoMethodError)

Gem files will remain installed in C:/tibbr/main/tools/jruby/lib/ruby/gems/1.8/gems/sqlite3-1.3.4 for inspection. Results logged to C:/tibbr/main/tools/jruby/lib/ruby/gems/1.8/gems/sqlite3-1.3.4/ext/sqlite3/gem_make.out

Any suggestions? Thanks in advance

2

2 Answers

6
votes

Yes, JRuby doesn't like native extensions. This is one of a few that I've run into so far. As senthil mentions, switch to the jdbc adapter addresses this issue. An example of the config change:

Gemfile

# gem 'sqlite3'
gem 'activerecord-jdbcsqlite3-adapter', :require => 'jdbc-sqlite3', :require =>'arjdbc'
1
votes

its very simple, we need a jave (sqlitejdbc-v056.jar) lib file to support with jruby.

And i am using jdbc adapter for my project and using gem (activerecord-sqlite3-adapter). Its working fine. Sorry for very simple question.