This guide will help you (mostly will help me in the future) to configure your Ruby on Rails to support connection to Sybase.
I wrote this tutorial after everything’s good, so, I might miss a few steps that I’ve forgotten. Feel free to comment about it. With some adjustments, this guide will also works with Mac OS X.
Install FreeTDS. For Slackware users, you can get Slackbuild script at http://slackbuilds.org/repository/13.37/development/freetds/
/etc/freetds/freetds.confand put your database configurations in it:
[myserver] host = myserver.com port = 5000 tds version = 5.0
Test the configuration, you should get something like this:
$ tsql -S myserver -U username locale is "C" locale charset is "ANSI_X3.4-1968" using default charset "ISO-8859-1" Msg 5704 (severity 10, state 1) from ???: "Changed client character set setting to 'iso_1'. " 1>
Put this gems in your
gem 'arel-sybase-visitor', :git => 'https://github.com/ifad/arel-sybase-visitor' gem 'activerecord-sybase-adapter', :git => "https://github.com/ifad/activerecord-sybase-adapter"
An example configuration for your
development: adapter: sybase dataserver: myserver username: password: database:
You can try some query using your
rails consoleto make sure everything works fine.
If you’re trying to connect from your
irbdirectly without using ActiveRecord you may want to put additional parameters. This works for me:
client = TinyTds::Client.new( :username => '', :password => '', :dataserver => 'myserver', :tds_version => '100', :encoding => 'iso_1' )
That’s it, good luck!