Problem getting SQLServer adapter connected

554 views
Skip to first unread message

Chris

unread,
Dec 21, 2011, 9:48:49 AM12/21/11
to Rails SQLServer Adapter
Hi,

I'm running Rails 3.13 and Ruby 1.93 on Windows server 2003 r2 with
SQL Server 2005. I followed the installation procedure on
https://github.com/rails-sqlserver/activerecord-sqlserver-adapter/wiki/Using-TinyTds
which was successful. Just to make sure I'm not missing something,
all I did was the following 2 commands:

$ gem install tiny_tds
$ gem install activerecord-sqlserver-adapter

To start, I created a new application and tried out the default sqlite
database, which worked fine. However, when I changed database.yml to
use the sqlserver adapter (1) i can't get it to connect to SQL Server,
and (2) a resource that was previously found/served when using sqlite
is no longer served

The default "Welcome Aboard" Rails page shows, but the server cannot
find rails.png
[server log] Started GET "/assets/rails.png" for xxx.xxx.xx.xx at
2011-12-21 09:38:04 -0500

The expected "Served asset" message never appears, instead this does:

ActiveRecord::ConnectionNotEstablished
(ActiveRecord::ConnectionNotEstablished):

Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/
action_dispatc
h/middleware/templates/rescues/_trace.erb (0.0ms)
Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/
action_dispatc
h/middleware/templates/rescues/_request_and_response.erb (31.3ms)
Rendered C:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.1.3/lib/
action_dispatc
h/middleware/templates/rescues/diagnostics.erb within rescues/layout
(62.5ms)


I must be missing something but I'm not sure what, nor am I certain
about what to try out next or how to dig deeper into the problem.

Thanks in advance for your help.

Chris

Ken Collins

unread,
Dec 21, 2011, 10:03:25 AM12/21/11
to rails-sqlse...@googlegroups.com

You are going to want to focus on just loading rails console and seeing if you can load a model, hence get a connection. Debugging from the browser will not be helpful. To that end, this is likely just not having a user, host setup correctly in either the SQL Server database or your database.yml. Speaking of which, what is in your database.yml?

- Ken

Chris

unread,
Dec 23, 2011, 8:30:02 AM12/23/11
to Rails SQLServer Adapter
OK, this is interesting. Check out this trace. Even though gem
install was reported as being successful, the installation doesn't
appear to be complete. I tried gem uninstall and installing again and
got the same problem. What do you think I might try next?

D:\work\dms>gem install activerecord-sqlserver-adapter
Fetching: activerecord-sqlserver-adapter-3.1.4.gem (100%)
Successfully installed activerecord-sqlserver-adapter-3.1.4
1 gem installed
Installing ri documentation for activerecord-sqlserver-
adapter-3.1.4...
Installing RDoc documentation for activerecord-sqlserver-
adapter-3.1.4...

D:\work\dms>rails generate scaffold BarcodedItem barcode:string
invoke active_record
C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/lib/
active_record/connect
ion_adapters/abstract/connection_specification.rb:71:in `rescue in
establish_con
nection': Please install the sqlserver adapter: `gem install
activerecord-sqlser
ver-adapter` (cannot load such file -- active_record/
connection_adapters/sqlserv
er_adapter) (RuntimeError)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/
lib/active_r
ecord/connection_adapters/abstract/connection_specification.rb:68:in
`establish_
connection'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/
lib/active_r
ecord/connection_adapters/abstract/connection_specification.rb:60:in
`establish_
connection'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/activerecord-3.1.3/
lib/active_r
ecord/connection_adapters/abstract/connection_specification.rb:55:in
`establish_
connection' ...............

Ken Collins

unread,
Dec 23, 2011, 8:39:19 AM12/23/11
to rails-sqlse...@googlegroups.com

The gem is fine. You problem is that the adapter is not part of your bundle. You should add it to your Gemfile (like all other gems) and bundle install.

- Ken


Chris Downey

unread,
Dec 23, 2011, 8:52:46 AM12/23/11
to rails-sqlse...@googlegroups.com
Ken,

Thank you very much.  Its working fine now.  Whew!

Chris


On Fri, Dec 23, 2011 at 8:39 AM, Ken Collins <k...@metaskills.net> wrote:

The gem is fine. You problem is that the adapter is not part of your bundle. You should add it to your Gemfile (like all other gems) and bundle install.

 - Ken


--
You received this message because you are subscribed to the Google Groups "Rails SQLServer Adapter" group.
To post to this group, send email to rails-sqlse...@googlegroups.com.
To unsubscribe from this group, send email to rails-sqlserver-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rails-sqlserver-adapter?hl=en.


Reply all
Reply to author
Forward
0 new messages