JRuby and SQLite3 Living Together

A few days ago I decided to download the Fat Free CRM, an open source Rails based CRM platform. In order to get it going with sqlite3 with JRuby on Rails, there were a couple things I needed to do in order to get started. This solution can be used for any general jruby/rails/sqlite3 that you may have; I only mention this particular application to give some context to the problem.

First of all, you’ll need to install a couple gems.

sudo jruby -S gem install jdbc-sqlite3
sudo jruby -S gem install activerecord-jdbcsqlite3-adapter

Next, you’ll need to configure your config/database.yml file to use the appropriate driver for sqlite3.

development:
  adapter: jdbcsqlite3
  database: db/development.sqlite3
  timeout: 5000

That should solve any dreaded “no such file to load” errors that you encounter.

About these ads

8 responses to this post.

  1. Thank you so much! I’ve been stressing out trying to get jRuby, Rails, and Sqlite3 working together for a while. I was just about to abandon it and return to Ruby on Rails, but your post saved me.

    +1 to you.

    Thanks a ton!

    Reply

  2. Thanks! Worked for me :)

    Reply

  3. Posted by David on July 20, 2011 at 1:42 am

    where is the config/database.yml file located?

    Reply

  4. Posted by Vipin on August 3, 2011 at 4:36 am

    Thanks a lot .It was very helpful

    Reply

  5. Thanks for posting this. It is a simple and sweet example of how to use sqllite in JRuby. I found it very helpful.

    Reply

  6. Thanks, this saved me some research time

    Reply

  7. Posted by Ricardo Galeno on April 1, 2013 at 9:05 pm

    Thank you so much!! Helped me a lot!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: