In a previous article (Sybase DB Adapter) I wrote how I tried to install the Sybase adapter in an attempt to get access to an existing SybaseASA 9.0.2 DB. After doing some research I found that this adapter only works for the Enterprise edition of Sybase (i.e. SybaseASE).
So I needed to find an alternative that would work with SybaseASA or SQLAnywhere. After a lot of searching I came across a group dedicated to this task, at this stage there is not a lot of activity. One of the postings from Bryan Lahartinger proved very helpful, in the article he mentions "odbc-rails". I did a google search and found there is a Ruby project ODBC Adapter for Ruby on Rails / Active Record that has been developing an ODBC adapter for use with Rails.
The latest release has added support for SQLAnywhere so I dowloaded and installed it. There is a home page for this project which provides detailed installation instructions. I do my Rails development on Windows using InstantRails, a quick check confirmed that Christian Werner’s ODBC module comes preloaded with InstantRails so I did not have to install it separately. I downloaded the gem file for V2.0 from rubyforge and installed it using:
gem install -l activerecord-odbc-adapter-2.0.gem –include-dependencies
I setup my database.yml file to use the DSN I had previously defined to access the DB, i.e.
I started my server which loaded without any problem but when I tried to run my application I got the following error:
ODBCAdapter: Unsupported database (adaptiveserveranywhere)
As SybaseASA is the same as SQLAnywhere I changed the following line in odbc_adapter.rb (line #:1585) to get me going from:
elsif dbmsName =~ /SQLAnywhere/i
elsif dbmsName =~ /SQLAnywhere/i or dbmsName =~ /adaptiveserveranywhere/i
So far everything seems to working without any problems, I’ve asked if it will be possible to get this change added to the gem, if not I will need to monkeypatch the source. Next I will attempt to do an install under Suse Linux as this is where the application will ultimately reside.
Update: I’ve now added the monkey-patch to my application see Rails ODBC Adapter with Sybase Adaptive Server Anywhere (SybaseASA)