Nick Sieger: ActiveRecord JDBC adapter as Rails plugin tag:blog.nicksieger.com,2005:Typo Typo 2007-08-31T17:25:43+00:00 Nick urn:uuid:33bd024e-6a0a-497a-ae03-9f71efc7d74b 2006-09-08T16:31:14+00:00 2007-08-31T17:25:43+00:00 Comment 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> Hasan urn:uuid:a147d7ec-c4f8-4382-9372-059f889c12d2 2006-09-07T22:20:25+00:00 2007-08-31T17:25:41+00:00 Comment on ActiveRecord JDBC adapter as Rails plugin by Hasan <p>I&#8217;m trying to use this adapter with rails (rev. 5505). I put in &#8220;adapter: jdbc&#8221; into config/database.yml; I get &#8220;no such file to load &#8211; java&#8221; from rake. There&#8217;s no gem named java either. The jvm is on my path. Do I need to install jruby?</p> Manyi Lu urn:uuid:b8046a40-a1ea-4a76-af7e-99adb64d87f3 2006-08-17T13:52:03+00:00 2007-08-31T17:25:41+00:00 Comment 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 Sieger urn:uuid:698d3238-c164-45fd-a7c4-0c07199a71df 2006-06-26T17:53:00+00:00 2007-08-31T17:25:40+00:00 ActiveRecord JDBC adapter as Rails plugin <p>I&#8217;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 &#8216;script/plugin&#8217; 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&#8217;t, let me know and we&#8217;ll work through it. I haven&#8217;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&#8217;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&#8217;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&#8217;ve got the plugin set up to re-initialize all of the ActiveRecord infrastructure, so in order to use the JDBC adapter plugin, you&#8217;ll need to add the following to your <code>config/environment.rb</code>. Note that you&#8217;re not &#8220;skipping&#8221; 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>