May 15

Sybase DB Adapter

etienne @ 12:26 pm

 Update: This adapter only works with the enterprise edition of Sybase (i.e. Sybase ASE) not with SQLAnywhere (Sybase ASA)

One of my Rails projects require me to connect to a Sybase ASA database, I quickly figured out that I needed to install the sybase adapter as in Rails 2.0.2 these and some of the other databases have been pulled out of Rails core. According to the information in this article you can achieve this by using this command:

gem install activerecord-sybase-adapter

When I tried this I got the following error:

ERROR:  could not find activerecord-database-adapter locally or in a repository

The only way I got it to work was to use the -s option ("Use URL as the remote source for gems"), i.e.

gem install activerecord-sybase-adapter -s

10 Responses to “Sybase DB Adapter”

  1. Rails and Sybase Adapative Server Anywhere (SQLAnywhere) | IT.Signals says:

    […] Sybase DB Adapter […]

  2. Billy says:

    Can you teach me how to use sybase ASE12.5 with Rails?

  3. john says:

    Thanks! Works great.

  4. john says:

    Well, maybe not so great. I’m trying to use Sybase from Rails. Even after doing “gem install activerecord-sybase-adapter -s” I get the following message when starting mongrel:

    /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’: no such file to load — activerecord-sybase-adapter (MissingSourceFile)

    Do I need to set some env vars? I’d appreciate any guidance. fwiw:

    $ gem list

    *** LOCAL GEMS ***

    actionmailer (2.2.2)
    actionpack (2.2.2)
    activerecord (2.3.1, 2.2.2)
    activerecord-sybase-adapter (
    activeresource (2.2.2)
    activesupport (2.3.1, 2.2.2)
    cgi_multipart_eof_fix (2.5.0)
    daemons (1.0.10)
    fastthread (1.0.1)
    gem_plugin (0.2.3)
    mongrel (1.1.5)
    rails (2.2.2)
    rake (0.8.4)

  5. Aldric says:

    John : don’t load it. Create the connection, ActiveRecord will load the adapter by itself.

    :adapter => “sybase”,
    :database => “test”,
    :host => “”,
    :usrname => “kevin”,
    :password => “test”)

  6. Justin says:

    When I do that, I still get the “nonexistent sybase adapter” error.

    ActiveRecord::AdapterNotFound: database configuration specifies nonexistent sybase adapter
    from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:82:in `establish_connection’
    from (irb):7

    Same thing when I use rails with the equivalent in database.yml

  7. Aldric says:

    “Update: This adapter only works with the enterprise edition of Sybase (i.e. Sybase ASE) not with SQLAnywhere (Sybase ASA)”
    You do have this installed on your machine right?
    I have been running into issues with this lately too. Try using “:adapter => sybaseanywhere” maybe?
    I realized that what I was doing in irb was only creating an object, not .. connecting, and that the connection generated an error. Maybe it works with earlier version of Rails (> 2.0 and

  8. Aldric says:

    Anybody know if we need to add specific DLLs to the Ruby installation to get this to work properly?

  9. Aldric says:
  10. Eugene says:

    You may need to install sybase-ctlib for activerecord-sybase-adapter to work
    windows binaries:
    It’s a pity that such sophisticated and widespread in enterprise db is so poorly supported by ruby/rails

Leave a Reply