There is currently no ODBC adapter for Rails. there is a db2 adapter,
am not familiar with how weil it works.
I have a similar situation. I have to access data on an AS/400. only
is via odbc. I use ruby dbi and ruby odbc to retrieve the information
create AR objects from the returned data. Seems to work well for my
situation since I am only retrieving data or calling stored procedures
I created a module in my lib dir and I require it where needed.
dbh = DBI::connect(“DBI:ODBC:” + LIB, UID, PWD)
row = dbh.select_one(“select * from table where something =
rescue DBI::DatabaseError => e
dbh.disconnect unless dbh.nil?
row.nil? ? nil : row
then in the controllers where I need to use it, I just add
then in the action where you want to use it:
@foo = Foo.new
something = AS400.find_something(@params[:something])
@foo.name = something unless something.nil?
rescue Exception => error
flash.now[‘error’] = "AS/400 Error: " + error
hope this helps.