Topic: JRuby does not support native extensions

While running a test script on NetBeans 6.0.1, i'm getting an error

C:/jruby-1.1.4/lib/ruby/site_ruby/1.8/jruby/openssl/gem_only.rb:3 warning: already initialized constant GEM_ONLY
Loaded suite C:\RubyDev\Brainstorm_dev\test\unit\product_test
Started
DEPRECATION WARNING: You're using the Ruby-based MySQL library that ships with Rails. This library will be REMOVED FROM RAILS 2.2. Please switch to the offical mysql gem: `gem install mysql`  See http://www.rubyonrails.org/deprecation for details. (called from mysql_connection at C:/jruby-1.1.4/lib/ruby/gems/1.8/gems/activerecord-2.1.1/lib/active_record/connection_adapters/mysql_adapter.rb:81)
inside test_productE
Finished in 0.407175 seconds.

When i'm trying to run "gem install mysql" i'm again getting an error:

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

C:/jruby-1.1.4/bin/jruby.bat extconf.rb install mysql
C:/jruby-1.1.4/lib/ruby/1.8/mkmf.rb:7: JRuby does not support native extensions.
Check wiki.jruby.org for alternatives. (NotImplementedError)
        from C:/jruby-1.1.4/lib/ruby/1.8/mkmf.rb:1:in `require'
        from extconf.rb:1


Gem files will remain installed in C:/jruby-1.1.4/lib/ruby/gems/1.8/gems/mysql-2
.7 for inspection.
Results logged to C:/jruby-1.1.4/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

Can any1 help me out?

Ruchir

Re: JRuby does not support native extensions

You need to install a jdbc MySQL driver. Google JRuby + MySQL

Re: JRuby does not support native extensions

I already have jar file (mysql-connector-java-5.0.4-bin.jar) included in my project (created using NetBeans)

Re: JRuby does not support native extensions

I'm pretty sure you also need the activerecord java driver to connect that to RoR

Re: JRuby does not support native extensions

I do have activeRecord JDBC rubygem also.

Re: JRuby does not support native extensions

Well based on your error message that was your OP you aren't setup to use it I would say. Like I said a Google search will get you articles showing you how to install and configure MySQL with JRuby.

Re: JRuby does not support native extensions

I think do you simply need to change database.yml
set

adapter: mysql

to
adapter: jdbcmysq

Re: JRuby does not support native extensions

Tejo, Thanks You very very much for your advice!!!!!