During migration I get this error from Rails that 2.2.2 no longer ships
mysql.rb:
$jruby -S rake db:create
(in C:/dev/rails/book)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please
install t
he mysql gem and try again: gem install mysql.
rake aborted!
no such file to load – mysql
When I try to do: jruby -S gem install mysql, it can’t install as jruby
does
not support native extension. So the only option I have is to
install activerecord-jdbcmysql-adapter or someone got any better way to
go
past these errors?
$jruby -S gem install mysql
JRuby limited openssl loaded. gem install jruby-openssl for full
support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
Building native extensions. This could take a while…
C:/tools/jruby/lib/ruby/1.8/mkmf.rb:7: JRuby does not support native
extensions.
Check wiki.jruby.org for alternatives. (NotImplementedError)
from C:/tools/jruby/lib/ruby/1.8/mkmf.rb:1:in `require’
from extconf.rb:1
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
As I understand it (and I’m no expert), what you’ve done is the
correct way to fix that. I also have a Rails 2.2.2 app that I run with
JRuby 1.1.5, and I have these gems installed to support it:
When I try to do: jruby -S gem install mysql, it can’t install as
jruby does not support native extension. So the only option I have is
to install activerecord-jdbcmysql-adapter or someone got any better
way to go past these errors?
I think another option is to copy the Ruby MySql driver to /lib. You can download it from Ruby/MySQL,
or just copy it from an older version of activerecord (e.g.
gems/activerecord-2.1.2/lib/active_record/vendor/mysql.rb). Probably
better to use the jdbc adapter anyway, just wanted to point out this
option too.
I think another option is to copy the Ruby MySql driver to /lib. You can download it from Ruby/MySQL,
or just copy it from an older version of activerecord (e.g.
gems/activerecord-2.1.2/lib/active_record/vendor/mysql.rb). Probably
better to use the jdbc adapter anyway, just wanted to point out this
option too.
Which raises another question; other than age/support, what IS the
reason for
not using the old mysql adapter? Is the JDBC one better in any way?
/home/ryan/opt/jruby-1.1.5/lib/ruby/1.8/mkmf.rb:7: JRuby does not
support
native extensions. Check wiki.jruby.org for alternatives.
(NotImplementedError)
from /home/ryan/opt/jruby-1.1.5/lib/ruby/1.8/mkmf.rb:1:in `require’
from extconf.rb:1
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
It’s because JRuby doesn’t run the native extensions. Your only real
choice
in that case it to install the jdbc variant.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.