How to install Ruby on Rails with Sybase anywhere adapter on Windows

Installing Rails on Windows and using Sybase as db for the first time is a pain. So I thought to write a how to:

1) Download latest stable release of Ruby from on to your computer.

2) Run the executable and follow the onscreen instructions.

3) Once Ruby is installed successfully then go to command prompt and type ruby -v then hit enter. If everything was done properly then you will see the version of ruby, something like this

ruby 1.8.6 (date ...) [..]

4) Now you need to download the latest gem from

5) Unzip it and then go to the command prompt again and type ruby setup.rb.

6) This will install the gem package manager. To be sure if everything went OK type gem -v on the command prompt to see the version of gem installed on your machine.

7) Now, to install rails run gem install rails --include-dependencies and wait while it is installed.

8) Once this process is complete then run rails -v and you should get the rails version as the output.

To communicate your rails app with Sybase you need to follow these steps.

1) Download file (by Michael Scott)

2) Inside you have two ruby files and a read me file:

  • Put sybaseanywhere_adapter.rb file under your ruby installation, i.e., ruby\lib\ruby\gems\1.8\gems\activerecord-1.13.2\lib\active_record\connection_adapters
  • Put sybaseanywhere.rb file file under your ruby installation, i.e., ruby\lib\ruby\gems\1.8\gems\activerecord-1.13.2\lib\active_record\vendor
  • Now add sybaseanywhere in ruby\lib\ruby\gems\1.8\gems\activerecord-1.13.2\lib\active_record.rb file like this
    RAILS_CONNECTION_ADAPTERS = %w( mysql postgresql sqlite firebird sqlserver db2 oracle sybase openbase frontbase sybaseanywhere )

3) Now create a directory called ADO, if you don’t already have it under your ruby installation directory, for example, ruby\lib\ruby\site_ruby\1.8\DBD

4) Download rub-dbi package from unzip it and put the ruby-dbi\lib\dbd\ADO.rb under your newly created directory ruby\lib\ruby\site_ruby\1.8\DBD\ADO

5) Your database.yml will also look a bit different like this

adapter: sybaseanywhere
dsn: dsn_name
mode: DBI:ADO

Obviously, you have to create your dsn name using windows control panel. Now thats something off topic and I imagine you already know how to do this.

On windows you can use Aptana as your IDE (download from here) since it is free and has plugins for rails, svn, etc.

2 thoughts on “How to install Ruby on Rails with Sybase anywhere adapter on Windows

  1. Dylan says:

    The above is not up to date for rails 2.x, although it still works. The above doesn’t work unless I set the mode to ‘odbc’.

Leave a Reply

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

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

Google photo

You are commenting using your Google 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 )

Connecting to %s