Miles to go …

August 27, 2007

ActiveRecord-JDBC 0.5 – simplified database configuration

Filed under: web2.0 — arungupta @ 12:02 am

ActiveRecord-JDBC 0.5 is now available. As mentioned earlier, one of the main features in this release is simplified database configuration for JRuby-on-Rails applications. From the release notes:

It is no longer necessary to specify :driver and :url configuration parameters for the mysql,  postgresql, oracle, derby, hsqldb, and h2 adapters.

This means that if you deploy a Rails application as a WAR file on GlassFish as described here, then there is no need to specify the JDBC adapter, the JDBC driver class name or the database connection URL. The ActiveRecord-JDBC uses the native MySQL adapter to connect directly to the database. And so there is no need to even copy MySQL Connector/J driver JAR file in GlassFish\lib directory.

This means the database configuration

production:
  adapter: jdbc
  driver: com.mysql.jdbc.Driver
  url: jdbc:mysql://localhost:3306/helloworld_development
  username: root
  password:

can now be written as

production:
  adapter: mysql
  database: HelloWorld_production
  username: root
  password:
  host: localhost

And this is the default configuration generated by Rails app anyway.

This really simplifies the database configuration for deploying Rails applications on GlassFish. As a result the steps described here (bullet 2 & 3),  here (bullet 4.2.1 & 4.2.2) and in screencast #web6 (10:52 – 11:56) are not required any more.

I’d like to point out that it’s not necessary to specify this information. But if you have any applications deployed with these settings, they’ll continue to work. Installing the plugin using the standard way (jruby script\plugin install activerecord-jdbc) will give you the latest version anyway.

I’m particularly excited about this change as it brings C-based Ruby and JRuby applications one step closer to each other.

Tom explained other simplifications.

Technorati: rubyonrails jrubyonglassfish jruby ruby glassfish mysql

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Related posts:
  1. Database-enabled RoR WAR on GlassFish
  2. TOTD #9: Using JDBC connection pool/JNDI name from GlassFish in Rails Application
  3. TOTD # 76: JRuby 1.2, Rails 2.3, GlassFish Gem 0.9.3, ActiveRecord JDBC Adapter 0.9.1 – can they work together ?
  4. TOTD #44: JDBC Connection Pooling for Rails on GlassFish v3
  5. TOTD #26: Overriding Database Defaults in Rails 2.0.2

6 Comments »

  1. good…..

    Comment by jiop — August 27, 2007 @ 1:28 am

  2. [Trackback] This one

    Comment by Nick Sieger — September 1, 2007 @ 9:47 pm

  3. [Trackback] The NetBeans IDE has simplified the steps to deploy JRuby on Rails application on GlassFish. This blog explains the steps and is an update to screencast #web6. Download the install the latest NetBeans 6 Nightly. I downloaded the Ruby pack…

    Comment by Arun Gupta's Blog — September 7, 2007 @ 5:36 am

  4. [Trackback] In an Earlier Post, I described how Mephisto (a popular web publishing system based on Ruby on Rails) can be deployed on GlassFish V3. Both JRuby and GlassFish has matured since then and this post will provide the updated instructions…

    Comment by Arun Gupta's Blog — November 15, 2007 @ 6:19 am

  5. as for me good

    Comment by satılık — January 26, 2008 @ 12:21 am

  6. hi, then what about the connections for oracle and glassfish? i have tried creating 1 but it kept giving me error saying cannot cast etc.

    please enlighten me

    Comment by ivy — October 14, 2008 @ 10:49 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress