Mac OS + Rails + JRuby

Hellos,

I’m trying to run a Rails application using JRuby on Mac OS(10.6.2) ,
however I’m using MySQL version that comes with MAMP server.
Unfortunately it seems that the connection with the MySQL is not
established
even though I’m setting the socket correctly.
Here is an error log http://pastie.org/751216, I have followed some
instructions mentioned
herehttp://boonedocks.net/mike/archives/175-MAMP-and-the-Ruby-MySQL-Gem.htmlto
run the app on Ruby MRI, but I don’t know what to do to make it work
with
JRuby.
Any ideas?

Thanks

There is no out-of-the-box MySQL support on JRuby.

You’ll want to take a look at this:
http://kenai.com/projects/jruby/pages/ActiveRecord-JDBC

Yea, I have used it, but now for this specific case for Mac OS + MAMP, i
thought there might be something else rather than setting the socket.

On Mon, Dec 21, 2009 at 01:57:45AM +0200, Khaled al Habache wrote:

JRuby.
Any ideas?

First of all, in Unix ‘Connection refused’ means that the client
couldn’t
connect to the server because (con refused = tcp port not open).
This could mean:

  • Wrong host name, should probably be localhost
  • Wrong port (should probably be 3306)
  • Service not running (Start it according to the manual)
  • Firewall in between which rejects tcp connections (Only when not
    localhost)

To see if mysql runs on your local machine you could do:

  • telnet localhost 3306
    if you get
    telnet: connect to address 127.0.0.1: Connection refused
    your service is not running
    if you see a mysql banner your db connector config must be wrong.

But I’d say this is not really related to JRuby or Rails.

And the instructions you were refering to are only for MRI – not for
jruby,
does it run with normal c ruby?

There are several tutorials out there which explain how to get to it
running
with JRuby, but get it working with MRI first.

Cheers
Reto


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Yes I’m able to run MRI based apps.
Here is a pastie for database.yml:
http://pastie.org/751715

Hi,

Judging from the docs at
http://kenai.com/projects/jruby/pages/ActiveRecord-JDBC it seems that
socket is not supported. Which confirms my findings that my applications
still worked after setting socket to a non existing file. So I would
remove the socket setting and check if the Ruby MRI app stills works.

Regards
Roger


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi,

it could help if you show the code that establish the connection. Im
using Mac OS X, JRuby and XAMPP and it works without any problems.

Regards
Roger

Am 21.12.2009 um 11:17 schrieb Khaled al Habache:

Now following Nick’s article and trying:

jruby script/generate jdbc

I get:
(erb):15: undefined local variable or method `jdbc’ for main:Object
(NameError)

This is using JRuby 1.4

On Mon, Dec 21, 2009 at 4:10 PM, Reto S. <

Ah solved that one, still the connection to the DB is not established.
Anyway, I have installed normal stuff and things are working now. Just
wanted to check if things will work smoothly with MAMP but it didn’t.
I won’t waste the whole day on this :stuck_out_tongue:

On Mon, Dec 21, 2009 at 02:48:20PM +0100, Roger G. wrote:

Judging from the docs at
http://kenai.com/projects/jruby/pages/ActiveRecord-JDBC it seems that socket
is not supported. Which confirms my findings that my applications still
worked after setting socket to a non existing file. So I would remove the
socket setting and check if the Ruby MRI app stills works.

And read Nick’s post about ‘jruby script/generate jdbc’. This allows you
to use
the same database.yml for MRI and Jruby.
Fresh 0.9.2 activerecord-jdbc-adapter Release

Cheers,
Reto


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email