Skip to main content

TOTD #35: Rails Database Connection on Solaris

Posted by arungupta on June 23, 2008 at 11:18 AM PDT

Are you deploying your JRuby-on- href="http://rubyonrails.org">Rails applications
on Solaris
(or any variety of Unix) and not able to connect to the database ?



I experienced it last week so thought of sharing the tip here. Luckily
it's really simple.



Here is the default generated "config/database.yml"


cellspacing="2">
development:

  adapter: mysql

  encoding: utf8

  database: runner_development

  username: root

  password:

  socket: /tmp/mysql.sock



The only required change is to add "host: 127.0.01" for the required
database configuration. The updated fragment is shown below (with
change highlighted):


cellspacing="2">
development:

  adapter: mysql

  encoding: utf8

  database: runner_development

  username: root

  password:

  socket: /tmp/mysql.sock

  host:
127.0.01



Even though "host" is required for TCP connections but the database
connection does not seem to work without this entry. The exact same
application works without "host" entry on Windows and Mac OS.



Alternatively, you can always install the JDBC adapter as href="http://wiki.jruby.org/wiki/Running_Rails_with_ActiveRecord-JDBC">explained
here.

Please leave suggestions on other TOTD (Tip Of The Day) that
you'd like to see.
A complete archive is available href="http://blogs.sun.com/arungupta/tags/totd">here.

Technorati: totd
rubyonrails
jruby href="http://technorati.com/tag/ruby">ruby href="http://technorati.com/tag/opensolaris">opensolaris
mysql

Related Topics >>