# Problem Connecting to MS SQL Server 2005

**URL:** <https://www.ruby-forum.com/t/problem-connecting-to-ms-sql-server-2005/126822>\
**Category:** Rails\
**Created:** [January 22, 2008, 3:45pm UTC](https://www.ruby-forum.com/t/problem-connecting-to-ms-sql-server-2005/126822 "2008-01-22T15:45:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![caof2005](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/97f17d/32.png) [@caof2005](https://www.ruby-forum.com/u/caof2005)\
**Post date:** [January 22, 2008, 3:45pm UTC](https://www.ruby-forum.com/t/problem-connecting-to-ms-sql-server-2005/126822/1 "2008-01-22T15:45:03Z")

</div>

Hello Friends:

I would appreciate a lot your help on the following situation.

I’m trying to connect to MS SQL Server 2005 but I’m getting the  
following error while trying to execute a scaffold command:

C:\ruby\RoR1.2.6\rails\work\demoPba0\>ruby script\generate scaffold  
receta receta

```
  exists app/controllers/
  exists app/helpers/
  exists app/views/receta
  exists app/views/layouts/
  exists test/functional/

```

dependency model  
exists app/models/  
exists test/unit/  
exists test/fixtures/  
identical app/models/receta.rb  
identical test/unit/receta\_test.rb  
identical test/fixtures/recetas.yml  
Open  
OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server  
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist  
or access  
denied.  
HRESULT error code:0x80020009  
Exception occurred.

I tried to follow step by step the instructions that appears in the  
HowtoConnectToMicrsoftSQLServer article  
([Peak Obsession](http://wiki.rubyonrails.com/rails/pages/HowtoConnectToMicrosoftSQLServer)):

1. I got and unpack the last DBI from  
[http://rubyforge.org/projects/ruby-dbi/](http://rubyforge.org/projects/ruby-dbi/)  
and I copied this file to my path  
c:/ruby/lib/ruby/site\_ruby/1.8/DBD/ADO/ADO.rb

2. I modified my .yml file demoPba0/config/database.yml

# =\> demoPba0 is the name of my app

# =\> demoPba0\_development is the name of the DB

development:  
adapter: sqlserver  
database: demoPba0\_development  
host: DBI:ADO:Provider=SQLOLEDB;Data Source=(local);Initial  
Catalog=demoPba0\_development;User Id=sa;Password=password1;  
username: sa  
password: password1

but the final result still is the same

My environment is: Windows XP SP2, Ruby 1.8.26, RoR 1.2.6, MS SQL Server  
Enterprise 2005  
All my environment is local.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![caof2005](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/97f17d/32.png) [@caof2005](https://www.ruby-forum.com/u/caof2005)\
**Post date:** [January 23, 2008, 5:39am UTC](https://www.ruby-forum.com/t/problem-connecting-to-ms-sql-server-2005/126822/2 "2008-01-23T05:39:02Z")

</div>

On Jan 22, 2008 9:45 AM, Carlos O.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> username: sa  
> password: password1

I haven’t connected to a SQL Server 2005 database in awhile, but two  
things  
jump out at me. First, you don’t need to specify the username and  
password  
twice, but I don’t know if it matters in which place you do specify it.  
Second, replace (local) with localhost.

Let us know whether it works.

Regards,  
Craig
