# How to connect SQLserver in rails

**URL:** <https://www.ruby-forum.com/t/how-to-connect-sqlserver-in-rails/158360>\
**Category:** Rails\
**Created:** [January 22, 2009, 1:16pm UTC](https://www.ruby-forum.com/t/how-to-connect-sqlserver-in-rails/158360 "2009-01-22T13:16:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![angaps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/77aa72/32.png) [@angaps](https://www.ruby-forum.com/u/angaps)\
**Post date:** [January 22, 2009, 1:16pm UTC](https://www.ruby-forum.com/t/how-to-connect-sqlserver-in-rails/158360/1 "2009-01-22T13:16:05Z")

</div>

Hai All

I am newbie for the rails environment.

I want to know how to connect the Sqlserver 2005 to the rails  
application.

I have tried from the link  
[http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer](http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer)

1. gem install activerecord-sqlserver-adapter  
–source=[http://gems.rubyonrails.org](http://gems.rubyonrails.org)

2. downloaded the ruby-dbi gem and pasted in the ruby/bin directory

3. In database.yml

development:  
adapter: sqlserver  
database: elite\_db  
host: ANG-LAPTOP  
username: sa  
password:

the error iam getting is

=\> Booting WEBrick…  
JRuby limited openssl loaded. gem install jruby-openssl for full  
support.  
[http://wiki.jruby.org/wiki/JRuby\_Builtin\_OpenSSL](http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL)  
C:/Program Files/NetBeans  
6.5/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:512:in  
`require': Please install the sqlserver adapter: `gem install  
activerecord-sqlserver-adapter`(no such file to load -- active_record/connection_adapters/sqlserver_adapter) (RuntimeError) from C:/Program Files/NetBeans 6.5/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39 from C:/Program Files/NetBeans 6.5/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:27:in`require’  
from C:/Program Files/NetBeans  
6.5/ruby2/jruby-1.1.4/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require’  
from script\server:3

then i tried with the

1. gem install jruby-openssl ( installed this one)

again getting the same error.

kindly note it, iam working in the netbeans IDE 6.5, but running my  
project in the installed ruby 1.8.6 and webrick server.

1. then i tried with the rails plugins installations in the netbeans IDE  
itself, getting partial installed openssl, stating needed svn.

2. i installed .svn client in my machine.

but i dont know how to add the svn in the netbeans IDE. TELL ME.

kindly reply me soon.

----\>how to use the sqlserver 2005 to the rails application.

-----\>and then how to access the sqlserver from another machine ( a  
common server) in my rails application in my machine.

I have one more doubt can we access the webrick server or mongrel server  
from another machine to deploy my rails application.

ex: railsapplication A in the my machine ( using ruby 1.8.6)

```
  webrick server in another machine ( different host)

```

Is it possible.

kindly give me you valuable suggestions.

thanks

Angaps

---

<div class="post-metadata">

**Author:** ![angaps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/77aa72/32.png) [@angaps](https://www.ruby-forum.com/u/angaps)\
**Post date:** [January 22, 2009, 1:19pm UTC](https://www.ruby-forum.com/t/how-to-connect-sqlserver-in-rails/158360/2 "2009-01-22T13:19:28Z")

</div>

I am developing the rails application in the windows XP.

---

<div class="post-metadata">

**Author:** ![angaps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/77aa72/32.png) [@angaps](https://www.ruby-forum.com/u/angaps)\
**Post date:** [January 22, 2009, 2:06pm UTC](https://www.ruby-forum.com/t/how-to-connect-sqlserver-in-rails/158360/3 "2009-01-22T14:06:10Z")

</div>

I think the first line is a red herring

> JRuby limited openssl loaded. gem install jruby-openssl for full  
> support.

This is the line thats causing you problems:

> C:/Program Files/NetBeans  
> 6.5/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active\_support/dependencies.rb:512:in  
> `require': Please install the sqlserver adapter:`gem install  
> activerecord-sqlserver-adapter` (no such file to load –  
> active\_record/connection\_adapters/sqlserver\_adapter) (RuntimeError)

Double check that you have the sqlserver installed:

For windows its:  
c:\Ruby\lib\ruby\gems\1.8\gems\

Although by the looks of it your using JRuby so it might be slightly  
different.

Cheers  
Luke

---

<div class="post-metadata">

**Author:** ![angaps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/77aa72/32.png) [@angaps](https://www.ruby-forum.com/u/angaps)\
**Post date:** [January 22, 2009, 2:10pm UTC](https://www.ruby-forum.com/t/how-to-connect-sqlserver-in-rails/158360/4 "2009-01-22T14:10:03Z")

</div>

Actually looking at it…how have you installed ruby? Via the one-click  
installer?

Looks like netbeans is using its own jruby installation at:  
C:/Program Files/NetBeans/6.5/ruby2/jruby-1.1.4/lib/ruby/gems/1.8/gems/

So you may find although you gem installed the sqlserver adapter that  
was installed to the default ruby folder (i.e. c:\ruby…\gems) rather  
than the jruby folder that netbeans is using above.

Cheers  
Luke

---

<div class="post-metadata">

**Author:** ![angaps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/77aa72/32.png) [@angaps](https://www.ruby-forum.com/u/angaps)\
**Post date:** [January 22, 2009, 4:01pm UTC](https://www.ruby-forum.com/t/how-to-connect-sqlserver-in-rails/158360/5 "2009-01-22T16:01:00Z")

</div>

Angappan Ayyavoo wrote:

> 1. gem install jruby-openssl ( installed this one)

That was just a warning.

Run rake test from a command line, and don’t go back to Netbeans until  
you have  
passing tests, and can tell the difference between your own bugs and  
JRuby bugs.

Then configure Netbeans to pick up your own Ruby VM, not JRuby!

---

<div class="post-metadata">

**Author:** ![angaps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/77aa72/32.png) [@angaps](https://www.ruby-forum.com/u/angaps)\
**Post date:** [January 22, 2009, 2:41pm UTC](https://www.ruby-forum.com/t/how-to-connect-sqlserver-in-rails/158360/6 "2009-01-22T14:41:20Z")

</div>

Hai Luke

Thanks for your reply.

Actually running the one-time installer ruby 1.8.6

I think the first line is a red herring

> JRuby limited openssl loaded. gem install jruby-openssl for full  
> support

this above error is bcoz of the built jruby, by mistakenly i modified  
the application’s property.

and know the error iam getting by running the cmd prompt is :

C:\Ruby\elite\>ruby script/server  
=\> Booting WEBrick…  
Missing these required gems:  
datanoise-actionwebservice

You’re running:  
ruby 1.8.6.287 at C:/Ruby/bin/ruby.exe  
rubygems 1.3.1 at C:/Documents and Settings/aayyavoo/.gem/ruby/1.8,  
C:/Ruby/lib/ruby/gems/1.8

Run `rake gems:install` to install the missing gems.

I tried with rake gems:install

getting rake aborted.

C:\Ruby\elite\>rake gems:install  
(in C:/Ruby/elite)  
rake aborted!  
Could not load driver (no such file to load –  
C:/Ruby/lib/ruby/site\_ruby/1.8/dbd/ADO)

(See full trace by running task with --trace)

i have pasted the ruby-dbi gem 0.4.1 in the ruby/bin directory  
how can i install this in the cmd prompt to reflect in the

c:/ruby/lib/…

thanks

---

<div class="post-metadata">

**Author:** ![angaps](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/77aa72/32.png) [@angaps](https://www.ruby-forum.com/u/angaps)\
**Post date:** [January 22, 2009, 4:56pm UTC](https://www.ruby-forum.com/t/how-to-connect-sqlserver-in-rails/158360/7 "2009-01-22T16:56:13Z")

</div>

Angappan Ayyavoo wrote:

> C:\Ruby\elite\>rake gems:install  
> (in C:/Ruby/elite)  
> rake aborted!  
> Could not load driver (no such file to load –  
> C:/Ruby/lib/ruby/site\_ruby/1.8/dbd/ADO)
> 
> (See full trace by running task with --trace)
> 
> i have pasted the ruby-dbi gem 0.4.1 in the ruby/bin directory  
> how can i install this in the cmd prompt to reflect in the
> 
> c:/ruby/lib/…

To install dbi for sql server - you need to download the ruby dbi zip  
package (v0.2.x)

e.g.

[http://rubyforge.org/frs/download.php/41304/dbi-0.2.2.zip](http://rubyforge.org/frs/download.php/41304/dbi-0.2.2.zip)

From that zip file you need to extract:  
dbi-0.2.2.zip\dbi-0.2.2\lib\dbd\ADO.rb

and copy it to:  
C:\Ruby\lib\ruby\site\_ruby\1.8\DBD\ADO.rb

That will get ADO up & running for sql server.

Cheers  
Luke
