Rails + Sybase ASE : group effort, please

Here’s what I have:
Ruby 1.8.7
Rails 2.3.3 (activerecord 2.3.3, etc)
activerecord-sybase-adapter ( http://itsignals.cascadia.com.au/?p=23 )

Here is the base code (login info was changed to protect me)
require ‘rubygems’
require ‘activerecord’

a = ActiveRecord::Base.establish_connection(
:adapter => “sybase”,
:host => “localhost”,
:port => 123,
:username => “read_only”,
:password => “read_only”,
:database => “mydb”
)

puts a
puts

a.connection


Here is the output:

#ActiveRecord::ConnectionAdapters::ConnectionPool:0x3e1b740

c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybct.rb:27:in connect': connect failed (RuntimeError) from c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybct.rb:27:inopen’
from c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybsql.rb:269:in
initialize' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sybase-adapter-1.0.0.9250/lib/active_record/connection_adapters/sybase_adapter.rb:46:innew’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-sybase-adapter-1.0.0.9250/lib/active_record/connection_adapters/sybase_adapter.rb:46:in
sybase_connection' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:insend’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
new_connection' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:245:incheckout_new_connection’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in
checkout' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:inloop’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
checkout' from c:/ruby/lib/ruby/1.8/monitor.rb:242:insynchronize’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in
checkout' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:inconnection’
from C:/scripts/OneOffs/lib/TalkingToPacs.rb:16


sybase_adapter.rb, line 45:
ConnectionAdapters::SybaseAdapter.new(
SybSQL.new({‘S’ => host, ‘U’ => username, ‘P’ => password},
ConnectionAdapters::SybaseAdapterContext), database, config,
logger)


sybct.rb (line 27 is indicated)

class SybConnection
def SybConnection.open (*args)
conn = nil
raise(“illegal args count”) if( args.length < 3 )
ctx = args[0]
srv = args[1]
user = args[2]
psw = “” ; appname = nil; hname = nil;
psw = args[3] if(args.length >= 4 )
appname = args[4] if(args.length >= 5 )
hname = args[5] if(args.length >= 6 )
begin
conn = SybConnection.new( ctx )
if( hname != nil ) then
raise(“NG: setprop(hostname)”) unless( conn.setprop(CS_HOSTNAME,hname
))
end
# Open a Server connection.
conn.connect( ctx, srv, user, psw, appname ) ## THIS IS LINE 27 ##
rescue
conn.delete if( conn.kind_of?( SybConnection ) )
conn = nil # No use ( for GC or callback ??? )
raise # Regenerates exception
end
return conn
end
end


I am out of my league when it comes to drivers, so I don’t know the next
steps to take to troubleshoot this. Ideas are very welcome. DLL
suggestions, etc etc, are also welcome :slight_smile: Getting this to work would
help me immensely (and possibly the community, too).

The solution will most likely end up written in :
http://groups.google.com/group/ruby-on-rails-sybase-developers/t/fc1139eeba6e6a0c

I am in contact with One Who Knows (or, at least, One Who Seems To
Know).

Ah. A solution. How sweet.

http://trevoke.net/blog/2009/09/11/connecting-to-sybase-with-rails-on-windows-xp/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs