# ActiveRecord::ConnectionNotEstablished error

**URL:** <https://www.ruby-forum.com/t/activerecord-connectionnotestablished-error/194601>\
**Category:** Rails\
**Created:** [September 7, 2010, 6:30pm UTC](https://www.ruby-forum.com/t/activerecord-connectionnotestablished-error/194601 "2010-09-07T18:30:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bopritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/71e660/32.png) [@bopritchard](https://www.ruby-forum.com/u/bopritchard)\
**Post date:** [September 7, 2010, 6:30pm UTC](https://www.ruby-forum.com/t/activerecord-connectionnotestablished-error/194601/1 "2010-09-07T18:30:32Z")

</div>

I’ve attached my database.yml  
I’ve installed gem install activerecord-sqlserver-adapter

But when I navigate to a simple page I get the  
ActiveRecord::ConnectionNotEstablished error

Any ideas what I should be checking?

Ruby 1.92  
Rails 3

---

<div class="post-metadata">

**Author:** ![bopritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/71e660/32.png) [@bopritchard](https://www.ruby-forum.com/u/bopritchard)\
**Post date:** [September 7, 2010, 11:01pm UTC](https://www.ruby-forum.com/t/activerecord-connectionnotestablished-error/194601/2 "2010-09-07T23:01:54Z")

</div>

I’ve never used sqlserver before but I would start with the  
development.log file for clues.

Assuming there is a command line client can you connect to the  
database with it? Can you ping your db host “mordor”? In dev the  
host is usually localhost (in linuxland anyway).

---

<div class="post-metadata">

**Author:** ![bopritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/71e660/32.png) [@bopritchard](https://www.ruby-forum.com/u/bopritchard)\
**Post date:** [September 7, 2010, 11:04pm UTC](https://www.ruby-forum.com/t/activerecord-connectionnotestablished-error/194601/3 "2010-09-07T23:04:14Z")

</div>

try conecty with irb use ActiveRecord::Base.establish\_conection(  
hash\_here)

the hash for MS SQL server is {:adapter =\>“sqlserver”, :mode=\> “ado”,  
:database=\>“db name here”, :host=\> “host\_here” }

you need to be able to resolve the host from the machine if you use a  
name

---

<div class="post-metadata">

**Author:** ![bopritchard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/71e660/32.png) [@bopritchard](https://www.ruby-forum.com/u/bopritchard)\
**Post date:** [September 8, 2010, 5:28pm UTC](https://www.ruby-forum.com/t/activerecord-connectionnotestablished-error/194601/4 "2010-09-08T17:28:42Z")

</div>

Tony P. wrote:

> I’ve never used sqlserver before but I would start with the  
> development.log file for clues.
> 
> Assuming there is a command line client can you connect to the  
> database with it? Can you ping your db host “mordor”? In dev the  
> host is usually localhost (in linuxland anyway).

yep, i can ping it and connect via command line fine. i checked the  
development.log and didn’t see anything of interest.
