This is known to work on ASE 12.5.1 – you’re welcome to let me know what else worked, I am particularly curious about later versions of Sybase ASE, such as 15.
- Sybase PC Client 12.52
- The Ruby Sybase files
- gem install activerecord-sybase-adapter -s http://gems.rubyonrails.org
Put the Sybase files in C:\ruby\lib\ruby\site_ruby\1.8\i386-msvcrt .
Copy all the DLLs in %SYBASE%\OCS-12_5\dll and put them in %RUBY%\bin (if you are not familiar with Windows notation, this simply means to go where you installed each of Sybase and Ruby and then go to the proper subdirectory). Why all of them? Well, because I’m too lazy to know which ones we -do- need.
Set some environment variables, just to make sure Sybase works fine:
Right-click on My Computer, Properties > Advanced > Environment Variables
If you have full permissions, go ahead and add those as SYSTEM VARIABLES.. Otherwise, well, only for your user (but aren’t you doing this on a server?).
SYBASE=c:\sybase (where you installed Sybase).
JDBC_HOME=c:\sybase\jConnect-6_0 (again, where you installed Sybase, then the subdirectory).
CLASSPATH=%JDBC_HOME%\classes\jconn3.jar (just make sure that’s the right number).
If you’re going to create a user on your Sybase server for specific Rails usage, it needs to have SELECT permissions on the following : sysobjects, syscolumns, systypes, syscomments.
Edit your %SYBASE%\ini\sql.ini and add the information for your server in there.
Next.. In Rails, the magic will look like this in database.yml :
production: adapter: sybase database: <YOUR_DB_HERE> username: <USERNAME> password: <PASSWORD> host: <NAME_GIVEN_IN_SQL_INI_HERE>
And that should be pretty much it!
Don’t forget to edit your model if you’re working with legacy data:
class Patient < ActiveRecord::Base set_table_name "some_odd_name" set_primary_key "some_primary_key_column" end