Using a local MS SQL Server


#1

I would appreciate any tips/clues/advice very much.

I have started using ruby on rails and when the MS SQL Server database
is on
a different box than my dev box (where the RoR app is located) I can
connect
fine. However when I try to connect to a MS SQL Server database on the
same
box as my RoR app I get an error. I have tried to use the IP address of
the
dev box as the value of “host” as well as “localhost” but nothing works.
I
am using Windows 2000, SQL Server 7, and RoR v 1.0. Here is my
configuration.yml file and a copy of the error :

development:
adapter: sqlserver
database: cookbook_development
host: 127.0.0.1
username: sa
password: password

DBI::DatabaseError in Recipe#index

Open
OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server
Cannot open database requested in login ‘cookbook_development’.
Login fails.
HRESULT error code:0x80020009
Exception occurred.

RAILS_ROOT: ./script/…/config/…
Application Trace | Framework Trace | Full Trace

c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb:57:in connect' c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:inconnect’
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:in connect' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect ion_adapters/sqlserver_adapter.rb:40:insqlserver_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:145:in
send' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect ion_adapters/abstract/connection_specification.rb:145:inconnection_without_query_cache=’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/query_c
ache.rb:54:in
connection=' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect ion_adapters/abstract/connection_specification.rb:106:inretrieve_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:20:in
connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb :518:incount_by_sql’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb
:511:in
count' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagin ation.rb:167:incount_collection_for_pagination’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagin
ation.rb:188:in
paginator_and_collection_for' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagin ation.rb:124:inpaginate’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/scaff
olding.rb:101:in
list' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/scaff olding.rb:94:inindex’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.
rb:853:in
send' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base. rb:853:inperform_action_without_filters’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filte
rs.rb:332:in
perform_action_without_benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/bench marking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/bench
marking.rb:69:in
measure' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/bench marking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescu
e.rb:82:in
perform_action' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base. rb:369:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.
rb:369:in
process_without_session_management_support' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/sessi on_management.rb:116:inprocess’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in
dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:117:inhandle_dispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:83:in
service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' c:/ruby/lib/ruby/1.8/webrick/server.rb:155:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:ineach’
c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in start' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:69:indispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/servers/webrick.rb:5
9
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require__' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/depend
encies.rb:214:in
require' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/server.rb:28 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire__’
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/depend encies.rb:214:inrequire’
script/server:3

c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb:57:in connect' c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:inconnect’
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:in connect' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect ion_adapters/sqlserver_adapter.rb:40:insqlserver_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:145:in
send' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect ion_adapters/abstract/connection_specification.rb:145:inconnection_without_query_cache=’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/query_c
ache.rb:54:in
connection=' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect ion_adapters/abstract/connection_specification.rb:106:inretrieve_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:20:in
connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb :518:incount_by_sql’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb
:511:in
count' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagin ation.rb:167:incount_collection_for_pagination’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagin
ation.rb:188:in
paginator_and_collection_for' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagin ation.rb:124:inpaginate’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/scaff
olding.rb:101:in
list' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/scaff olding.rb:94:inindex’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.
rb:853:in
send' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base. rb:853:inperform_action_without_filters’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filte
rs.rb:332:in
perform_action_without_benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/bench marking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/bench
marking.rb:69:in
measure' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/bench marking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescu
e.rb:82:in
perform_action' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base. rb:369:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.
rb:369:in
process_without_session_management_support' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/sessi on_management.rb:116:inprocess’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in
dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:117:inhandle_dispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:83:in
service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' c:/ruby/lib/ruby/1.8/webrick/server.rb:155:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:ineach’
c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in start' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:69:indispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/servers/webrick.rb:5
9
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require__' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/depend
encies.rb:214:in
require' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/server.rb:28 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire__’
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/depend encies.rb:214:inrequire’
script/server:3

c:/ruby/lib/ruby/site_ruby/1.8/DBD/ADO/ADO.rb:57:in connect' c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:584:inconnect’
c:/ruby/lib/ruby/site_ruby/1.8/dbi/dbi.rb:384:in connect' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect ion_adapters/sqlserver_adapter.rb:40:insqlserver_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:145:in
send' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect ion_adapters/abstract/connection_specification.rb:145:inconnection_without_query_cache=’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/query_c
ache.rb:54:in
connection=' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect ion_adapters/abstract/connection_specification.rb:106:inretrieve_connection’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connect
ion_adapters/abstract/connection_specification.rb:20:in
connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb :518:incount_by_sql’
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/base.rb
:511:in
count' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagin ation.rb:167:incount_collection_for_pagination’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagin
ation.rb:188:in
paginator_and_collection_for' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/pagin ation.rb:124:inpaginate’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/scaff
olding.rb:101:in
list' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/scaff olding.rb:94:inindex’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.
rb:853:in
send' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base. rb:853:inperform_action_without_filters’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/filte
rs.rb:332:in
perform_action_without_benchmark' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/bench marking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/bench
marking.rb:69:in
measure' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/bench marking.rb:69:inperform_action_without_rescue’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/rescu
e.rb:82:in
perform_action' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base. rb:369:insend’
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/base.
rb:369:in
process_without_session_management_support' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/action_controller/sessi on_management.rb:116:inprocess’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in
dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:117:inhandle_dispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:83:in
service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in run' c:/ruby/lib/ruby/1.8/webrick/server.rb:155:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:144:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:144:instart_thread’
c:/ruby/lib/ruby/1.8/webrick/server.rb:94:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:89:ineach’
c:/ruby/lib/ruby/1.8/webrick/server.rb:89:in start' c:/ruby/lib/ruby/1.8/webrick/server.rb:79:instart’
c:/ruby/lib/ruby/1.8/webrick/server.rb:79:in start' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/webrick_server.rb:69:indispatch’
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/servers/webrick.rb:5
9
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require__' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire’
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/depend
encies.rb:214:in
require' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/server.rb:28 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:inrequire__’
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:18:in
require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/depend encies.rb:214:inrequire’
script/server:3

Request

Parameters: None

Show session dump


flash: !ruby/hash:ActionController::Flash::FlashHash {}

Response
Headers: {“cookie”=>[], “Cache-Control”=>“no-cache”}


#2

On 12/18/05, Greg removed_email_address@domain.invalid wrote:

the
dev box as the value of “host” as well as “localhost” but nothing
works. I
am using Windows 2000, SQL Server 7, and RoR v 1.0. Here is my
configuration.yml file and a copy of the error :
[…]

HI Greg,

I have success using the local hostname as the host. “local” is
supposed to
work too.
Can you contact your SQL instance via SQL Query Analyzer?
Also, are you using SQL 2000 Standard/Developer/Enterprise ? If you’re
using MSDE the rules are different (I think).

Did that work ?