Sybase Adapter for Ruby on Rails on Windows 2000 - abnormal

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!

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

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

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

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

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

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