Connecting SQL Server and Rails 4.2.1

38 views
Skip to first unread message

ganesh akella

unread,
May 5, 2015, 1:02:45 PM5/5/15
to rubyonra...@googlegroups.com

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


Scott Ribe

unread,
May 5, 2015, 1:55:48 PM5/5/15
to rubyonra...@googlegroups.com, ganesh akella
On May 5, 2015, at 10:37 AM, ganesh akella <gann...@gmail.com> 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 Ribe
scott...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice





Scott Ribe

unread,
May 5, 2015, 2:51:02 PM5/5/15
to rubyonra...@googlegroups.com, ganesh akella
On May 5, 2015, at 11:55 AM, Scott Ribe <scott...@elevated-dev.com> wrote:
>
> 2) 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.

KlausG

unread,
May 7, 2015, 3:23:32 PM5/7/15
to rubyonra...@googlegroups.com, gann...@gmail.com
> 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. 

Reply all
Reply to author
Forward
0 new messages