# Rails and SQL Server 2005 Express

**URL:** <https://www.ruby-forum.com/t/rails-and-sql-server-2005-express/105076>\
**Category:** Rails\
**Created:** [May 25, 2007, 3:51pm UTC](https://www.ruby-forum.com/t/rails-and-sql-server-2005-express/105076 "2007-05-25T15:51:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![inari](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/838e76/32.png) [@inari](https://www.ruby-forum.com/u/inari)\
**Post date:** [May 25, 2007, 3:51pm UTC](https://www.ruby-forum.com/t/rails-and-sql-server-2005-express/105076/1 "2007-05-25T15:51:33Z")

</div>

I was looking at the Wiki in regards to info on getting Rails and SQL  
Express 2005 to place nice together but the wiki seems to have some old  
material on it. Can anyone tell me if Rails does indeed support SQL  
Express 2005 and how to go about correctly adding support for it from a  
Windows (Vista) machine? Also, is anyone currently using SQL Express  
2005 and Rails together?

Here is the page I was reading:  
[http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer](http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer)

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![inari](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/i/838e76/32.png) [@inari](https://www.ruby-forum.com/u/inari)\
**Post date:** [May 25, 2007, 7:13pm UTC](https://www.ruby-forum.com/t/rails-and-sql-server-2005-express/105076/2 "2007-05-25T19:13:23Z")

</div>

Hi,

A Rails app can connect to SQL Server 2005 Express. The main issue of  
which  
to be aware, though, is that Express installs as a named instance by  
default. Therefore, in your database.yml file, you must provide both the  
server name (your machine name) and the named instance (SQLEXPRESS by  
default). For example:

test:  
adapter: sqlserver  
mode: ado  
database: sql2k5\_spike\_test  
username: user  
password: pwd  
host: DBI:ADO:Provider=SQLOLEDB;Data Source=MACHINE\_NAME\SQLEXPRESS;

Note that I had to use uppercase for the machine\instance. Furthermore,  
neither localhost (uppercase or lowercase) nor 127.0.0.1 would suffice  
in  
place of my machine name. This is unfortunate if multiple people will be  
working on the project, as each of their machine names will be unique.

Therefore, you should consider installing Express as a default (unnamed)  
instance. If you’ve already installed as a named instance, you’ll have  
to  
reinstall as a default instance. Then you can just use localhost in  
place of  
machine\instance for development and test.

test:  
adapter: sqlserver  
mode: ado  
database: sql2k5\_spike\_test  
username: user  
password: pwd  
host: DBI:ADO:Provider=SQLOLEDB;Data Source=localhost;

Almost forgot… I did all of this on Windows XP Pro, as I don’t have  
access to Vista. You’ll just have to give it a try and let us know how  
it  
goes. 🙂

Regards,  
Craig
