RubyOnRails with MS SQL - Connectivity Error


#1

Hi all…
Please help me solve the issue.
While trying to create a connection with MS SQL database in RubyOnRails,
I’m getting a ‘Deprecated …’ error. (I referenced a doc posted in net
for the same.)
System details: OS: Windows Xp
Ruby version: 1.8.6
Rails: 2.1.2
Gems: 1.3.1
RadRails: 0.7.2
Ruby-dbi: 0.2.0
Also installed the ADO.rb file and placed in
D:\Ruby\lib\ruby\site_ruby\1.8\DBD\ADO

PFB the details of the error. Please put some light on this.
** Invoke db:create (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:create
rake aborted!
no such file to load – deprecated
D:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' D:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inrequire’
D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in
require' D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:355:innew_constants_in’
D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:in
require' D:/Ruby/lib/ruby/site_ruby/1.8/dbi.rb:48 D:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:ingem_original_require’
D:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:inrequire’
D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:355:in
new_constants_in' D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/dependencies.rb:510:inrequire’
D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/kernel/requires.rb:7:in
require_library_or_gem' D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/kernel/reporting.rb:11:insilence_warnings’
D:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.2/lib/active_support/core_ext/kernel/requires.rb:5:in
require_library_or_gem' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/sqlserver_adapter.rb:28:insqlserver_connection’
D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in
send' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:inconnection=’
D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:260:in
retrieve_connection' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:inconnection’
D:/Ruby/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/tasks/databases.rake:32:in
create_database' D:/Ruby/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/tasks/databases.rake:26 D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:incall’
D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:621:in execute' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:ineach’
D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:616:in execute' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:582:ininvoke_with_call_chain’
D:/Ruby/lib/ruby/1.8/monitor.rb:242:in synchronize' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:575:ininvoke_with_call_chain’
D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:568:in invoke' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2031:ininvoke_task’
D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in
top_level' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:ineach’
D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2009:in
top_level' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:instandard_exception_handling’
D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2003:in
top_level' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1982:inrun’
D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:2048:in
standard_exception_handling' D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake.rb:1979:inrun’
D:/Ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/bin/rake:31
D:\Ruby\bin\rake:19:in load' D:\Ruby\bin\rake:19 -e:3:inload’
-e:3

A prompt reply would be appreciated.


#2

Weird;

Whats in your database.yml?

I take it you’ve installed the sqlserver-adapter?

From a command prompt if you run ruby script\server does it die
immediately or is it only when you try to find on a model?

Cheers
Luke


#3

I had a similiar issue but I am developing on Mac OSX, Rails 2.1.2,
ruby-dbi 0.40, and a self fork version of sqlserver adapter. I know
ruby-dbi 0.40 requires the gem deprecated >= 2.0. Maybe that’s what
you are missing too.

On Jan 23, 8:49 am, Tony P. <rails-mailing-l…@andreas-


#4

Hi Luke,

PFB the details in database.yml

development:
adapter: sqlserver
database: Test123
username: sa
password: test@123
host: kec4121228d

Yes, I have downloaded the sql_adapter and placed it in
<ruby_home>\lib\ruby\gems\1.8\gems\activerecord-2.1.2\lib\active_record\connection_adapters

PFA the sqlserver-adapter. Please verify and let me know if I have
installed the correct one. All I did was placed the adapter in this
location and tried to re-connect to the remote SQL server from RadRails.

Awaiting your response to proceed further.

Regards,
Tony

Luke P. wrote:

Weird;

Whats in your database.yml?

I take it you’ve installed the sqlserver-adapter?

From a command prompt if you run ruby script\server does it die
immediately or is it only when you try to find on a model?

Cheers
Luke


#5

Luke P. wrote:

iawgens had the answer - you need to install the deprecated gem

From a command prompt:
gem install deprecated

See here another person with the same issue
http://stackoverflow.com/questions/130547/setting-up-rails-to-work-with-sqlserver

Thanks a lot Luke… Let me try the same


#6

iawgens had the answer - you need to install the deprecated gem

From a command prompt:
gem install deprecated

See here another person with the same issue
http://stackoverflow.com/questions/130547/setting-up-rails-to-work-with-sqlserver


#7

Hi Luke,

I installed deprecated-2.0.1.gem I have also installed the gem dbi-0.4.0
and placed the ADO.rb file in the location :
<Ruby_Home>\lib\ruby\site_ruby\1.8\DBD\ADO
and now I’m getting a different error as shown below:

  • Invoke db:migrate (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    ** Execute db:migrate
    rake aborted!
    Unable to load driver ‘ADO’
    D:/Ruby/lib/ruby/site_ruby/1.8/dbi.rb:286:in load_driver' D:/Ruby/lib/ruby/1.8/monitor.rb:242:insynchronize’
    D:/Ruby/lib/ruby/site_ruby/1.8/dbi.rb:236:in load_driver' D:/Ruby/lib/ruby/site_ruby/1.8/dbi.rb:154:in_get_full_driver’
    D:/Ruby/lib/ruby/site_ruby/1.8/dbi.rb:139:in connect' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/sqlserver_adapter.rb:46:insqlserver_connection’
    D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in
    send' D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:inconnection=’
    D:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:260:in
    `retrieve_connection’

Awaiting your response again :slight_smile:

Tony P. wrote:

Luke P. wrote:

iawgens had the answer - you need to install the deprecated gem

From a command prompt:
gem install deprecated

See here another person with the same issue
http://stackoverflow.com/questions/130547/setting-up-rails-to-work-with-sqlserver

Thanks a lot Luke… Let me try the same


#8

I have also installed the gem dbi-0.4.0

Tony,

I would stick with the older version of ADO one of the 2.x series I’m
not sure it’ll work with the new dbi.

Cheers
Luke