Nick Sieger: ActiveRecord JDBC 0.5 tag:blog.nicksieger.com,2005:Typo Typo 2007-09-03T03:24:16+00:00 Jon Tirsen urn:uuid:13bad3ea-70b1-46e9-8c1e-a55b508b7537 2007-09-03T03:24:16+00:00 2007-09-03T03:24:16+00:00 Comment on ActiveRecord JDBC 0.5 by Jon Tirsen <p>Don&#8217;t forget you need to require the jar files for each database you need to use.</p> Nick Sieger urn:uuid:ed536239-db15-4a7d-963b-469c4b020d8f 2007-09-02T04:47:26+00:00 2007-09-02T04:47:26+00:00 ActiveRecord JDBC 0.5 <p>This one&#8217;s a bit late &#8211; consider it part of my <a href="/articles/2007/07/13/pause">get-caught-up-since-unclogging-the-clogged-blog</a> series.</p> <p>ActiveRecord JDBC 0.5 is out, so you may have heard (it went out the door a week ago Friday; c.f. <a href="http://blogs.sun.com/arungupta/entry/activerecord_jdbc_0_5_simplified">Arun</a> and <a href="http://www.bloglines.com/blog/ThomasEEnebo?id=36">Tom</a>). The major feature you get in this version is a new <code>database.yml</code> configuration style:</p> <div class="typocode"><pre><code class="typocode_default ">development: adapter: mysql database: blog_development username: root password:</code></pre></div> <p>Ok, ok, so what&#8217;s the big deal? This is just Rails&#8217; default database configuration. Well, that&#8217;s the point &#8211; you no longer have to know anything about JDBC URLs, driver class names, and all that. We&#8217;ve baked it in for you. This should make it easier than ever to try out your Rails application on JRuby, as the only piece of manual configuration left for you is the ugly bit of JRuby-specific code you need to <a href="http://www.headius.com/jrubywiki/index.php/Running_Rails_with_ActiveRecord-JDBC">activate ActiveRecord-JDBC</a> lurking right above the <code>Rails::Initializer</code>:</p> <div class="typocode"><pre><code class="typocode_ruby "><span class="keyword">if</span> <span class="constant">RUBY_PLATFORM</span> <span class="punct">=~</span> <span class="punct">/</span><span class="regex">java</span><span class="punct">/</span> <span class="ident">require</span> <span class="punct">'</span><span class="string">rubygems</span><span class="punct">'</span> <span class="ident">gem</span> <span class="punct">'</span><span class="string">ActiveRecord-JDBC</span><span class="punct">'</span> <span class="ident">require</span> <span class="punct">'</span><span class="string">jdbc_adapter</span><span class="punct">'</span> <span class="keyword">end</span></code></pre></div> <p>If we can obliterate the need for this last bit of code, and make it easy to obtain the necessary driver bits, I&#8217;ll feel good enough to call this thing a 1.0 product.</p>