# Sybase Adapter for Ruby on Rails on Windows 2000 - abnormal

**URL:** <https://www.ruby-forum.com/t/sybase-adapter-for-ruby-on-rails-on-windows-2000-abnormal/111730>\
**Category:** Rails\
**Created:** [August 10, 2007, 6:18am UTC](https://www.ruby-forum.com/t/sybase-adapter-for-ruby-on-rails-on-windows-2000-abnormal/111730 "2007-08-10T06:18:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![stitcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@stitcher](https://www.ruby-forum.com/u/stitcher)\
**Post date:** [August 10, 2007, 6:18am UTC](https://www.ruby-forum.com/t/sybase-adapter-for-ruby-on-rails-on-windows-2000-abnormal/111730/1 "2007-08-10T06:18:32Z")

</div>

Hi!

I’m trying to use Sybase adapter to connect to legacy Sybase ASE 12.5,  
I’ve copied all the required libraries to the appropriate places :-))

But the strange thing is that I can query the database only twice. The  
third call just crashes ROR server (both WEBrick or Mongrel). The  
message I get is -

abnormal program termination  
Process finished with exit code 3

I’m using plain model, empty. And the call is like @profiles =  
Profile.find(:all)  
The table contains 20 rows. I can even query another table, with  
millions of rows, but again only twice.

My RapidSQL client works just fine with this database. As well as  
plugin for IDEA.

Where can I look for a problem? Should I upgrade my OpenClient to  
verson 15?

Thanks!

---

<div class="post-metadata">

**Author:** ![stitcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@stitcher](https://www.ruby-forum.com/u/stitcher)\
**Post date:** [August 10, 2007, 5:26pm UTC](https://www.ruby-forum.com/t/sybase-adapter-for-ruby-on-rails-on-windows-2000-abnormal/111730/2 "2007-08-10T17:26:57Z")

</div>

I have upgraded Sybase Open Client to version 15.0.1

Still getting the same error. Ruby just crashes.

Is anyone here using Sybase from Ruby on Rails on Windows? Give me a  
hint, please?

Andrey

---

<div class="post-metadata">

**Author:** ![stitcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@stitcher](https://www.ruby-forum.com/u/stitcher)\
**Post date:** [August 13, 2007, 2:33pm UTC](https://www.ruby-forum.com/t/sybase-adapter-for-ruby-on-rails-on-windows-2000-abnormal/111730/3 "2007-08-13T14:33:54Z")

</div>

I faintly remember having a similar problem on RHEL. Unfortunately i  
can’t remember the solution. Here are some of my experiences with  
Sybase and Rails, hopefully they’ll help. To give you an idea of our  
environment, I develop on windows xp (and a mac) using a local mysql  
server. We have stagging and production environments running RHEL4  
which connect to Sybase running on separate AIX servers.

1. Package up the sybase-ctlib binaries into a gem

This makes for easier distribution of the binaries.

1. Verify sybase-ctlib works without Rails

Removing Rails from the equation helps shrink the scope of the  
problem. Having a gem here makes things easier. For example, via irb:

gem ‘sybase-ctlib-15’  
require ‘sybsql’

Then take a look at sybsql.rb for examples.

1. environment.rb

I had a problem getting sybase-ctlib in the load path. Here is the  
beginning of the config/environment.rb that works for me.

Rails::Initializer.run do |config|

# Put the Sybase bindings into ruby’s load path. It doesn’t work if

# added to the config#load\_paths. This is being done here because

# it doesn’t seem to work in the individual environment files.

if ENV[“RAILS\_ENV”] =~ /production|staging/  
$:.unshift(File.expand\_path("#{RAILS\_ROOT}/vendor/sybase-ctlib/  
lib"))  
end

1. sybinit.err

When there are errors the sybase client produces a file called  
sybinit.err in RAILS\_ROOT.

HTH

- jeremy

---

<div class="post-metadata">

**Author:** ![stitcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@stitcher](https://www.ruby-forum.com/u/stitcher)\
**Post date:** [August 13, 2007, 4:28pm UTC](https://www.ruby-forum.com/t/sybase-adapter-for-ruby-on-rails-on-windows-2000-abnormal/111730/4 "2007-08-13T16:28:19Z")

</div>

Thank you, Jeremy!

I can execute multiple requests to Sybase, and get the reslts back,  
but then after number of requests the application terminates.

For example in test script:

```
6.times do
    # Sending a sql-command to the server
  query.sql("select * from my_table")
end

```

6 times goes well, 7 times terminates the application.

And I cannot find sybinit.err or any references to it in the  
documentation.

Andrey

---

<div class="post-metadata">

**Author:** ![stitcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@stitcher](https://www.ruby-forum.com/u/stitcher)\
**Post date:** [August 14, 2007, 3:49pm UTC](https://www.ruby-forum.com/t/sybase-adapter-for-ruby-on-rails-on-windows-2000-abnormal/111730/5 "2007-08-14T15:49:14Z")

</div>

sybint.err must be specific to the linux client.

Looking through sybsql.rb and i noticed you can get some more debug  
info by setting $DEBUG = true. Maybe that can give you a little more  
info.

I also had a problem with the client locale not matching the server  
locale. I doubt that’s the problem because i receive a very explicit  
message but it’s worthing looking into. On the client machine make  
sure the server local is in $SYBASE\locales\locales.dat under the  
client OS, in this case “[NT]”.

Is it always 6 queries or does it appear to be random? Do you have a  
Windows XP machine to try this on?

- jeremy

---

<div class="post-metadata">

**Author:** ![stitcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@stitcher](https://www.ruby-forum.com/u/stitcher)\
**Post date:** [September 7, 2007, 9:05pm UTC](https://www.ruby-forum.com/t/sybase-adapter-for-ruby-on-rails-on-windows-2000-abnormal/111730/6 "2007-09-07T21:05:36Z")

</div>

The workaround was found - install VMWare and run the development  
under WinXP.

---

<div class="post-metadata">

**Author:** ![stitcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/82dd89/32.png) [@stitcher](https://www.ruby-forum.com/u/stitcher)\
**Post date:** [August 14, 2007, 10:29pm UTC](https://www.ruby-forum.com/t/sybase-adapter-for-ruby-on-rails-on-windows-2000-abnormal/111730/7 "2007-08-14T22:29:06Z")

</div>

Jeremy,

Setting the $DEBUG flag didn’t help much, the messages are non-  
informative. But thank you for the info. We also tried to tweak Sybase  
in some ways, we have a great DBA, but it didn’t help.

I was able to test the application on Win XP and for the number of  
tests I’ve performed Ruby never crashed. I just copied InstantRails  
from my machine to the test one. And Sybase install is the same on  
both.

Yes, the retry numbers are exact. But what freakens me out is that if  
I change the table name, I can get more or less results back. And I do  
select \* in all cases. And the numbers are stable, if it’s 14 for this  
table, then it’s 14 in the morning and in the evening, even with  
machine reboot and if the threshold is 6, then its 6 all the time.

One last time I’ve got a windows error message - ruby.exe crashed with  
error code -1073741819. I looked the code up and haven’t found any  
Ruby references to it, except for one Japanese site with Ruby test  
results and the same abnormal application termination and the same  
error code. The article is dated by 2004.

I guess the best way to go is upgrade the workstation and forget this  
issue. Seems nobody else is having it :-))

Andrey
