Here’s what I have:
Ruby 1.8.7
Rails 2.3.3 (activerecord 2.3.3, etc)
activerecord-sybase-adapter ( Index of / )
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:in
open’
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:in
new’
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:in
send’
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:in
checkout_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:in
loop’
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:in
synchronize’
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:in
connection’
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 Getting this to work would
help me immensely (and possibly the community, too).