Error connecting to Sybase (odd)

I have activerecord-sybase-adapter installed – and Sybase itself, so I
have the drivers.

In irb or in the rails console, this works:

ActiveRecord::Base.establish_connection(
:adapter => “sybase”,
:database => “mydb”,
:host => “myhost”,
:myport => myport,
:username => “read_only”,
:password => “read_only”)

In Rails, I have this in my database.yml:
pacs:
adapter: sybase
database: mydb
username: read_only
password: read_only
host: myhost
port: myport

And then I have the following model:
class PacsPatient < ActiveRecord::Base

establish_connection “pacs”
set_table_name “patient”
set_primary_key “pat_ckey”

end

So, when I go to the console and try to do something like…

PacsPatient.find 1

#Class:0x481a610: connect failed
from c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybct.rb:27:in
connect' 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.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:insend’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/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.2/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.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in
checkout' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:inloop’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/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.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in
checkout' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:inconnection’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in
retrieve_connection' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:123:inretrieve_connection’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:115:in
connection' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:3103:inquoted_table_name’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1583:in
find_one' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:1574:infind_from_ids’
from
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/base.rb:616:in
`find’
from (irb):1>>

So it seems that I’m doing something wrong… But what?

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