The current version of Rails comes with a Sybase ASE adapter that relies on the sybase-ctlib.
The following has has been tested with Visual Studio .NET 2003 and 2005 and Sybase 12.5 and 15.
http://raa.ruby-lang.org/project/sybase-ctlib/
Paste the following into a file named compile.bat in your extract folder
rem VS.NET 2003
rem set VC=C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
rem VS.Net 2005
set VC=C:\Program Files\Microsoft Visual Studio 8\VC
rem ASE 12.5
set SYBASE=C:\Program Files\Sybase1251
set OSC=OCS-12_5
set LIBS=libct.lib libcs.lib
rem ASE 15
rem set SYBASE=C:\Program Files\sybase
rem set OSC=OCS-15_0
rem set LIBS=libsybct.lib libsybcs.lib
set RUBY=C:\ruby
set VCINCLUDE=%VC%\include
set VCSDKINCLUDE=%VC%\PlatformSDK\Include
set RUBYINCLUDE=%RUBY%\lib\ruby\1.8\i386-mswin32
set SYBINCLUDE=%SYBASE%\%OSC%\include
set VCLIB=%VC%\lib
set VCSDKLIB=%VC%\PlatformSDK\Lib
set RUBYLIB=%RUBY%\lib
set SYBASELIB=%SYBASE%\%OSC%\lib
echo EXPORTS Init_sybct > sybct.def
cl -nologo -LD -Fesybct.so -I"%VCINCLUDE%" -I"%VCSDKINCLUDE%" -I"%RUBYINCLUDE%" -I"%SYBINCLUDE%" sybct.c /link /LIBPATH:"%SYBASELIB%" /LIBPATH:"%VCLIB%" /LIBPATH:"%RUBYLIB%" /LIBPATH:"%VCSDKLIB%" /def:sybct.def msvcrt-ruby18.lib %LIBS%
Edit this file to reflect your environment. All you should have to do is change the paths to VS.NET, Ruby, and Sybase, as well as the OSC version. In addition, you may have to change the names in LIBS depending on your sybase version. Check the names in SYBASE$\OSC%\lib to find out what they should be named here.
Run compile.bat and copy the generated files sybct.so , sybct.rb, and sybsql.rb to RUBYLIB\ruby\site_ruby\1.8\i386-msvcrt
If you get the following error:
%RUBYLIB%\lib\ruby\1.8\i386-mswin32\config.h(2) : fatal error C1189: #error : MSC version unmatch
Modify C:\ruby\lib\ruby\1.8\i386-mswin32\config.h. Remove or comment out the following (or set the appropriate compiler version):
#if _MSC_VER != 1200
#error MSC version unmatch
#endif
Now you should be able to talk to Sybase ASE using ActiveRecord on Windows.
The current version of Rails comes with a Sybase ASE adapter that relies on the sybase-ctlib.
The following has has been tested with Visual Studio .NET 2003 and 2005 and Sybase 12.5 and 15.
http://raa.ruby-lang.org/project/sybase-ctlib/
Paste the following into a file named compile.bat in your extract folder
rem VS.NET 2003
rem set VC=C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7
rem VS.Net 2005
set VC=C:\Program Files\Microsoft Visual Studio 8\VC
rem ASE 12.5
set SYBASE=C:\Program Files\Sybase1251
set OSC=OCS-12_5
set LIBS=libct.lib libcs.lib
rem ASE 15
rem set SYBASE=C:\Program Files\sybase
rem set OSC=OCS-15_0
rem set LIBS=libsybct.lib libsybcs.lib
set RUBY=C:\ruby
set VCINCLUDE=%VC%\include
set VCSDKINCLUDE=%VC%\PlatformSDK\Include
set RUBYINCLUDE=%RUBY%\lib\ruby\1.8\i386-mswin32
set SYBINCLUDE=%SYBASE%\%OSC%\include
set VCLIB=%VC%\lib
set VCSDKLIB=%VC%\PlatformSDK\Lib
set RUBYLIB=%RUBY%\lib
set SYBASELIB=%SYBASE%\%OSC%\lib
echo EXPORTS Init_sybct > sybct.def
cl -nologo -LD -Fesybct.so -I"%VCINCLUDE%" -I"%VCSDKINCLUDE%" -I"%RUBYINCLUDE%" -I"%SYBINCLUDE%" sybct.c /link /LIBPATH:"%SYBASELIB%" /LIBPATH:"%VCLIB%" /LIBPATH:"%RUBYLIB%" /LIBPATH:"%VCSDKLIB%" /def:sybct.def msvcrt-ruby18.lib %LIBS%
Edit this file to reflect your environment. All you should have to do is change the paths to VS.NET, Ruby, and Sybase, as well as the OSC version. In addition, you may have to change the names in LIBS depending on your sybase version. Check the names in SYBASE$\OSC%\lib to find out what they should be named here.
Run compile.bat and copy the generated files sybct.so , sybct.rb, and sybsql.rb to RUBYLIB\ruby\site_ruby\1.8\i386-msvcrt
If you get the following error:
%RUBYLIB%\lib\ruby\1.8\i386-mswin32\config.h(2) : fatal error C1189: #error : MSC version unmatch
Modify C:\ruby\lib\ruby\1.8\i386-mswin32\config.h. Remove or comment out the following (or set the appropriate compiler version):
#if _MSC_VER != 1200
#error MSC version unmatch
#endif
Now you should be able to talk to Sybase ASE using ActiveRecord on Windows.