How to connect SQLserver in rails

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

  1. gem install activerecord-sqlserver-adapter
    –source=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
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:inrequire’
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

I am developing the rails application in the windows XP.

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

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

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!

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

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

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