The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


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

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):

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

Please leave suggestions on other TOTD (Tip Of The Day) that you'd like to see. A complete archive is available here.

Technorati: totd rubyonrails jruby ruby opensolaris mysql
Related Topics >> Web Applications      
Comments
Comments are listed in date ascending order (oldest first)