Hi everyone,
Iv inherited some ruby code that talks to a sql db and iv never used
ruby before.
Ive tried to poke around to understand where the error below is coming
from but to no result.
[code]
C:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:264:in `initialize': wrong number
of arguments (1 for 2) (ArgumentError)
from C:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:264:in `exception'
from C:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:264:in `raise'
from C:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:264:in `load_driver'
from C:/ruby/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from C:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:242:in `load_driver'
from C:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:160:in
`_get_full_driver'
from C:/ruby/lib/ruby/site_ruby/1.8/dbi.rb:145:in `connect'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.21/lib/active_record/connection_adapters/sqlserver_adapter.rb:775:in
`connect'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.21/lib/active_record/connection_adapters/sqlserver_adapter.rb:211:in
`initialize'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.21/lib/active_record/connection_adapters/sqlserver_adapter.rb:26:in
`new'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-sqlserver-adapter-2.2.21/lib/active_record/connection_adapters/sqlserver_adapter.rb:26:in
`sqlserver_connection'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:223:in
`send'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.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.2.2/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.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:188:in
`checkout'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:184:in
`loop'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/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.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:183:in
`checkout'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:98:in
`connection'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.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.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:121:in
`retrieve_connection'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:113:in
`connection'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:2934:in
`quoted_table_name'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1520:in
`find_one'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:1511:in
`find_from_ids'
from
C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.2.2/lib/active_record/base.rb:590:in
`find'
from dtr_upload.rb:72
from dtr_upload.rb:63:in `each'
from dtr_upload.rb:63
[/code]
and the bit of code is
ActiveRecord::Base.establish_connection(
:adapter => "sqlserver",
:mode => "ODBC",
:dsn => "DSN",
:username => "USERNAME",
:password => "PASSWORD"
)
Any answers or info would be greatly appreciated.
···
--
Posted via http://www.ruby-forum.com/.