How to connect ruby on rails 3 to SQL Server

23 בMay 2012

one comment

create ruby project http://guides.rubyonrails.org/getting_started.html 


on Configuring a Database section if you decide  to connect to MSSQL try  this steps:


1)


open SQL Server and add your database


create database SharonBlog_development


2)


Open ROR config\database.yml set the connection string(simple connection property):


development:

  adapter: sqlserver

  host: sharon

  database: SharonBlog_development

  username: Usersharon


  password: fill in the password


3)A dd  ‘tiny_tds’ to Gemfile


open Gemfile  and add the new lines after gem ‘rails’, ’3.2.3′ :


source ‘https://rubygems.org’


gem ‘rails’, ’3.2.3′


gem ‘tiny_tds’


gem ‘activerecord-sqlserver-adapter’


4) Execute rake:migrate from command line:


open project config command line and run rake db:migrate


D:\eclipse\Workspace\SharonBlog\config>rake db:migrate


Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

one comment

  1. Alejandro Paciotti3 בJanuary 2013 ב 11:28

    Excelente !!!!!!! GRACIAS !

    Reply