Connecting SQL Server and Rails 4.2.1

https://lh3.googleusercontent.com/-i996epsjwwU/VUjxkeWqgxI/AAAAAAAADvw/CSg0Asl8nbo/s1600/console.JPG
Hello friends,

I am new in Ruby on rails. I am using Rails 4.2.1 and Ruby 2.0.0. For
some
reason I am not able to connect my sql server to rails.
Can anyone help me regarding the database.yml file on connecting to sql
server.
And is it the only file which I need to look into or are there any other
files which needs to be modified.?
I tried to follow the instructions in some of the web forums suggesting
to
fix this, but I am getting an error when I give “rails console” command.
I am trying to create a model and I am not able to do this.
Please help me out

https://lh3.googleusercontent.com/-i996epsjwwU/VUjxkeWqgxI/AAAAAAAADvw/CSg0Asl8nbo/s1600/console.JPG

On May 5, 2015, at 10:37 AM, ganesh akella [email protected] wrote:

Can anyone help me regarding the database.yml file on connecting to sql server.
And is it the only file which I need to look into or are there any other files
which needs to be modified.?
I tried to follow the instructions in some of the web forums suggesting to fix
this, but I am getting an error when I give “rails console” command.
I am trying to create a model and I am not able to do this.

  1. It looks like you have not installed a connection adapter for SQL
    Server. Rails does not automatically come with adapters for all
    databases. I don’t use it myself, but googling for "ruby on rails
    microsoft sql server” gets the adapter as the first hit, followed by a
    number of articles giving advice.

  2. Once you have that installed, then yes, that single .yml file is the
    only one you need to modify.

  3. In the future, please just copy and paste errors rather than sending
    us off to a website with a screen capture.


Scott R.
[email protected]
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice

On May 5, 2015, at 11:55 AM, Scott R. [email protected]
wrote:

  1. Once you have that installed, then yes, that single .yml file is the only one
    you need to modify.

I probably should have qualified that statement—it’s the only thing
directly related to Rails that you need to modify. But it’s still
possible that you will have some issue with firewalls, networking,
server config etc. Basically, once you can get any other tool on your
box to connect to the server on that type of connection, then the only
Rails-specific thing you need to do is setup .yml.


Scott R.
[email protected]
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice

Can anyone help me regarding the database.yml file on connecting to sql
server.

  1. It looks like you have not installed a connection adapter for SQL
    Server. Rails does not automatically come with adapters for all
    databases.
    I don’t > use it myself, but googling for "ruby on rails microsoft sql
    server” gets the adapter as the first hit, followed by a number of
    articles
    giving advice.

You need the ActiveRecord-SqlServer-Adapter:

and the TinyTDS gem: GitHub - rails-sqlserver/tiny_tds: TinyTDS - Simple and fast FreeTDS bindings for Ruby using DB-Library.