Forum: JRuby Issue with Rails 2.2.2 + Jruby for mysql adapter

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C525435d460373e31aed692ceb499b40?d=identicon&s=25 Vivek Pandey (Guest)
on 2008-11-27 01:10
(Received via mailing list)
I am trying to create a simple Rails 2.2.2 app using jruby 1.1.5. The
application is using mysql DB. The gems installed are:
$jruby -S gem list

*** LOCAL GEMS ***

actionmailer (2.2.2)
actionpack (2.2.2)
activerecord (2.2.2)
activeresource (2.2.2)
activesupport (2.2.2)
glassfish (0.9.0)
jdbc-mysql (5.0.4)
rack (0.4.0)
rails (2.2.2)
rake (0.8.3)
rspec (1.1.11)
sources (0.0.1)
[/c/dev/rails/book]


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.
----------------

-vivek.
Ff168162d53e22788d576582b3527e97?d=identicon&s=25 Bill Kocik (Guest)
on 2008-11-27 02:20
(Received via mailing list)
Hi Vivek -

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:

activerecord-jdbcmysql-adapter (0.8.2)
jdbc-mysql (5.0.4)

In my database.yml file, the adapter is configured like this:

development:
       host: localhost
       adapter: jdbcmysql
       database: tt_dev
       port: 3306
       username: root
       password:

Hope that's helpful (or at least not wrong). :)
D3b53a23feb47aeaf92538a797268ac3?d=identicon&s=25 Mikael Rudberg (Guest)
on 2008-11-27 07:09
(Received via mailing list)
Hi Vivek

Seems like you're missing the jdbc adapter

gem install activerecord-jdbcmysql-adapter
and change the adapters entry in database.yml to: adapter: jdbcmysql

/Mikael


Vivek Pandey wrote:
> activerecord (2.2.2)
>
> rake aborted!
> JRuby limited openssl loaded. gem install jruby-openssl for full support.
> ----------------
>
> -vivek.
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
50afd27dcbdf1ce85f07f047bac630bf?d=identicon&s=25 Erno Mononen (Guest)
on 2008-11-27 11:30
(Received via mailing list)
Vivek Pandey wrote:
> activerecord (2.2.2)
>
> 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?

I think another option is to copy the Ruby MySql driver to <rails
app>/lib. You can download it from http://www.tmtm.org/en/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.

Erno


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
76aed56df3e087c55e6961f9fca7a6aa?d=identicon&s=25 Michael Campbell (Guest)
on 2008-12-01 13:24
(Received via mailing list)
Erno Mononen wrote:

> I think another option is to copy the Ruby MySql driver to <rails
> app>/lib. You can download it from http://www.tmtm.org/en/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?

--
Twitter:  http://twitter.com/campbellmichael

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
F34d2984f36c86ecc19b32e7142a7354?d=identicon&s=25 Ryan Bell (Guest)
on 2008-12-01 15:12
(Received via mailing list)
Yeah. The MySql adapter has native code that does not run in the JVM.
And
the pure Ruby variant does not work on 4.1 or 5.x.

On Mon, Dec 1, 2008 at 7:24 AM, Michael Campbell <
C525435d460373e31aed692ceb499b40?d=identicon&s=25 Vivek Pandey (Guest)
on 2008-12-02 03:55
(Received via mailing list)
Wel, the mysql adapter works fine on JVM on windows platform. Although
for
some reason it does not work on ubuntu.

-vivek.
F34d2984f36c86ecc19b32e7142a7354?d=identicon&s=25 Ryan Bell (Guest)
on 2008-12-02 04:13
(Received via mailing list)
If you got an error on Ubuntu like this:

/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 topic is locked and can not be replied to.