Friday, June 6, 2008

activerecord-jdbc now supports SQLite3

Nick Seager just released Activerecord-jdbc-adapter 0.8.1 which now includes support for SQLite3. This is great news, since SQLite3 had become the default database for rails starting 2.0.2.

To use it of course you'll need the newly released activerecord-jdbc-adapter and the sqlite3 adapter.
   gem install activerecord-jdbcsqlite3-adapter

I believe the above command should get all necessary dependent gems install also. And the configuration for the database.yml:
production:
adapter: jdbcsqlite3
url: jdbc:sqlite:<path to sqlite3 dbfile>

The path can be relative path from your rails app directory or absolute path. The rest of the configuration is the same as other jruby on rails' setup.

One thing that I hope they will add is to allow the database.yml to accept dbfile parameter, so it will be easy to switch between RoR or JRoR for SQLite3.

Update on May 06, 2008 at 14:08 GMT+8
After checking out the source code for the sqlite support, I found that it indeed support regular config for sqlite3. So you can just have the following database.yml:
production:
adapter: jdbcsqlite3
database: <path to sqlite3 dbfile>

The only differentiation is the adapter, either sqlite3 or jdbcsqlite3.

No comments: