# Rails connection sqlserver 2005 there some wrong!

**URL:** <https://www.ruby-forum.com/t/rails-connection-sqlserver-2005-there-some-wrong/194958>\
**Category:** Rails\
**Created:** [September 14, 2010, 12:08pm UTC](https://www.ruby-forum.com/t/rails-connection-sqlserver-2005-there-some-wrong/194958 "2010-09-14T12:08:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![deandeng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@deandeng](https://www.ruby-forum.com/u/deandeng)\
**Post date:** [September 14, 2010, 12:08pm UTC](https://www.ruby-forum.com/t/rails-connection-sqlserver-2005-there-some-wrong/194958/1 "2010-09-14T12:08:47Z")

</div>

hi erevy one  
i use ruby 1.8.7 ,rails is 2.2.2

fisrt get the latest source distribution of Ruby-DBI from:  
[http://rubyforge.org/projects/ruby-dbi/](http://rubyforge.org/projects/ruby-dbi/) and copy the file:  
rub-DBI is 0.2.2

lib/dbd/ADO.rb

to:

X:/ruby/lib/ruby/site\_ruby/1.8/DBD/ADO/ADO.rb

then i install  
gem install activerecord-sqlserver-adapter -v=2.2.8

i run the server

error is  
establish\_connection please install the sqlserver adapter gem install  
activerecord-sqlserver-adapter  
no such file to load active\_record/connection\_adapters/sqlserver\_adapter

then i copy sqlserver\_adapter from ctiverecord-sqlserver-adapter-3.0.0  
to that palce

but that another error

active\_support/dependencies.rb:442 in ‘load\_missing\_constant’  
uninitialized constant activedrecord::wrappenddatabaseException

Anyone hit this ?

Regards,  
/deng

---

<div class="post-metadata">

**Author:** ![deandeng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@deandeng](https://www.ruby-forum.com/u/deandeng)\
**Post date:** [September 14, 2010, 2:16pm UTC](https://www.ruby-forum.com/t/rails-connection-sqlserver-2005-there-some-wrong/194958/2 "2010-09-14T14:16:54Z")

</div>

try using bundler to install the gem , it will try to find all the  
dependencies.

> **[\#201 Bundler - RailsCasts](http://railscasts.com/episodes/201-bundler)**
>
> Short Ruby on Rails screencasts containing tips, tricks and tutorials. Great for both novice and experienced web developers.

---

<div class="post-metadata">

**Author:** ![deandeng](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/9fc29f/32.png) [@deandeng](https://www.ruby-forum.com/u/deandeng)\
**Post date:** [September 15, 2010, 2:55pm UTC](https://www.ruby-forum.com/t/rails-connection-sqlserver-2005-there-some-wrong/194958/3 "2010-09-15T14:55:34Z")

</div>

Here is a series of steps that I had to go through in order to get  
SQLServer 2005 working for my needs. You might need to skip/replace  
some steps. I hope this helps you.

1. Install Ruby (1.8.6): [Download Ruby](http://www.ruby-lang.org/en/downloads/)
2. Install rubygems:  
a. [Download RubyGems | RubyGems.org | your community gem host](http://rubygems.org/pages/download) (zip version)  
b. Unpack to a directory and cd there  
c. ruby setup.rb
3. Install rails: gem install rails –v=2.3.5
4. Install mongrel: gem install mongrel
5. Install mongrel service: gem install mongrel\_service
6. Install SQL Server adapter: gem install activerecord-sqlserver-  
adapter
7. Install ODBC gem: gem install odbc-rails
8. Install SQL Server Management utility (from Microsoft)
9. Create SQL Server DB
10. Create login in SQL Server
11. Create DB user
12. Create DSN in Windows:  
a. Control Panel → Adminstrative Tasks → Data Sources (ODBC)  
b. Click on System DSN → Add  
c. Select type SQL Server  
i. Name: Whichever name you want to give it here.  
ii. Description: Your description here  
iii. Server: Server name (whichever is the server name you see  
in SQL Server Management utility)  
iv. Use SQL Authentication
