Nick Sieger: ActiveRecord JDBC adapter as Rails plugintag:blog.nicksieger.com,2005:TypoTypo2007-08-31T17:25:43+00:00Nickurn:uuid:33bd024e-6a0a-497a-ae03-9f71efc7d74b2006-09-08T16:31:14+00:002007-08-31T17:25:43+00:00Comment on ActiveRecord JDBC adapter as Rails plugin by Nick<p>Yes, you do. I appear to have mixed usages of Ruby a little too much in the article. Try it with JRuby, or better yet, follow along with <a href='http://ola-bini.blogspot.com/2006/09/activerecord-jdbc-020.html' rel="nofollow">more</a> <a href='http://headius.blogspot.com/2006/09/using-activerecord-jdbc-adapter.html' rel="nofollow">recent</a> howtos on using the AR-JDBC adapter. Have fun!</p>Hasanurn:uuid:a147d7ec-c4f8-4382-9372-059f889c12d22006-09-07T22:20:25+00:002007-08-31T17:25:41+00:00Comment on ActiveRecord JDBC adapter as Rails plugin by Hasan<p>I’m trying to use this adapter with rails (rev. 5505). I put in “adapter: jdbc” into config/database.yml; I get “no such file to load – java” from rake. There’s no gem named java either. The jvm is on my path. Do I need to install jruby?</p>Manyi Luurn:uuid:b8046a40-a1ea-4a76-af7e-99adb64d87f32006-08-17T13:52:03+00:002007-08-31T17:25:41+00:00Comment on ActiveRecord JDBC adapter as Rails plugin by Manyi Lu<p>A JDBC adapter is very useful.</p>
<p>If you are going to test with additional databases, Java DB or Apache Derby is a good choice, it runs in both embedded and client server mode. Java DB actually comes with jdk1.6.</p>Nick Siegerurn:uuid:698d3238-c164-45fd-a7c4-0c07199a71df2006-06-26T17:53:00+00:002007-08-31T17:25:40+00:00ActiveRecord JDBC adapter as Rails plugin<p>I’ve got things set up in my svn repo such that you pull down my
ActiveRecord JDBC adapter as a Rails plugin. Although it appears that
using ‘script/plugin’ inside of JRuby may have some issues. So for
now, use C Ruby. Inside your Rails app, do:</p>
<div class="typocode"><pre><code class="typocode_default ">ruby script/plugin install http://svn.caldersphere.net/svn/main/activerecord-jdbc/trunk/activerecord_jdbc/</code></pre></div>
<p>This should pull down and configure the JDBC adapter for you with no
additional setup. If it doesn’t, let me know and we’ll work through
it. I haven’t yet tried running a Rails app inside of JRuby yet but I
hope to in the next couple of days.</p>
<p>I am also starting to investigate testing with another database,
hsqldb. I think the driver could benefit from attempting to use some
additional databases, if we’re ever going to fulfill the promise of
leveraging any JDBC data source, and also I think it would be cool to
use an embedded database in the spirit of SQLite which has become
popular with smaller Rails apps in C Ruby-based Rails land.</p>
<p><em>Update:</em> it turns out you can’t easily install a new ActiveRecord adapter as a Rails plugin at this point with out some extra finagling, because of the way <code>Rails::Initializer</code> initializes the database before any of the plugins. For now, I’ve got the plugin set up to re-initialize all of the ActiveRecord infrastructure, so in order to use the JDBC adapter plugin, you’ll need to add the following to your <code>config/environment.rb</code>. Note that you’re not “skipping” ActiveRecord, just initializing it later.</p>
<div class="typocode"><pre><code class="typocode_ruby "> <span class="comment"># Skip frameworks you're not going to use</span>
<span class="ident">config</span><span class="punct">.</span><span class="ident">frameworks</span> <span class="punct">-=</span> <span class="punct">[</span><span class="symbol">:active_record</span><span class="punct">]</span></code></pre></div>