Hi, all!
[Note: this is a repost of How do I use Ruby on Rails 3.1 with DataMapper on JRuby with a DB2/400 database? - Stack Overflow . Feel
free to answer over there, if you like.]
I am developing a Rails 3.1 application on top of a legacy DB2/400
database. Because of the better support for legacy schemas, I opted to
use DataMapper instead of ActiveRecord as the ORM. The application is
going to be deployed on JRuby.
What is the best way to access a DB2 database in this case?
My initial research indicated that this would be trivial, since one of
the major selling points of using JRuby on Rails is that you get JDBC,
and thus access to pretty much any database on the planet.
However, it appears that is not necessarily true, in particular, there
doesn’t seem to be any driver for either ActiveRecord or
DataMapper/DataObjects for using DB2 over JDBC.
Do I have to write my own driver? From reading the source code of the
various existing DataObjects/DataMapper JDBC drivers, this shouldn’t
be too hard, but it is something I’d rather like to avoid.
Is there any ready-made solution (library, gem, blog post, tutorial)
for using DB2/400 with JRuby on Rails with DataMapper? If not, how do
I do it?
Thanks in advance,
jwm
Hi,
I have used activerecord-jdbc-adapter against an AS400 (db2 variant)
with no problems. Check out
for a start. I used this in Rails 2.3.X apps and a Rails 3.0.X app.
Also, I have used sequel do it
https://github.com/jeremyevans/sequel/blob/master/lib/sequel/adapters/jdbc/as400.rb
in a Rails 3.X app. You will need something like this too
In either of these cases some things are broken or missing like
migrations in arjdbc. I did have sequel migrations working with some
hacking.
I was never able to get it running with datamapper.
Thanks,
Brandon
Brandon H. wrote:
In either of these cases some things are broken or missing like
migrations in arjdbc. I did have sequel migrations working with
some hacking.
Thanks, that’s very helpful. The DB is “owned” by Synon models, so
migrations aren’t something I need to worry about anyway.
I was never able to get it running with datamapper.
jwm
Brandon H. wrote in post #1017155:
Hi,
I have used activerecord-jdbc-adapter against an AS400 (db2 variant)
with no problems. Check out
for a start. I used this in Rails 2.3.X apps and a Rails 3.0.X app.
Also, I have used sequel do it
https://github.com/jeremyevans/sequel/blob/master/lib/sequel/adapters/jdbc/as400.rb
in a Rails 3.X app. You will need something like this too
GitHub - bhauff/sequel-rails: A gem for using Sequel with Rails3
In either of these cases some things are broken or missing like
migrations in arjdbc. I did have sequel migrations working with some
hacking.
I was never able to get it running with datamapper.
Thanks,
Brandon
Hi, Brandon
I’m pretty new to ruby and rails. I’ve been working with IBM mid range
for some 30yrs. I’m try to prove the concept of using ruby and rails for
some new development and am quite comfortable with ruby and rails.
However, I’ve not be able to access data on our iSeries. Is there any
chance you could provide and example?
Thanks
Bob Nicholson