{"id":104,"date":"2009-06-16T15:09:47","date_gmt":"2009-06-16T15:09:47","guid":{"rendered":"http:\/\/nicholshayes.myzen.co.uk\/blog\/?p=104"},"modified":"2009-06-16T15:10:07","modified_gmt":"2009-06-16T15:10:07","slug":"ms-sql-server-connection","status":"publish","type":"post","link":"http:\/\/nicholshayes.co.uk\/blog\/?p=104","title":{"rendered":"MS SQL server connection"},"content":{"rendered":"<p>I noted the couple of steps I need to connect to a Microsoft SQL server in my <a href=\"http:\/\/www.nicholshayes.co.uk\/RailsWiki.html\">Rails Tiddly Wiki<\/a> under &#8220;MicrosoftSQL&#8221;. I&#8217;ve need to fire up a Rails development system on another PC and have found that the gems have moved on, and these instructions are now out of date (as are most of the instructions I found via a google search). In particular, Ruby-DBI no longer includes ADO.rb.<\/p>\n<p>I was able to get my system working &#8211; that is, a connection to a SQL 2005 server from a Rails application created with a previous SQL server set up and set up on an XP Pro PC &#8211; by doing the following:<\/p>\n<pre>\r\n  gem install activerecord-sqlserver-adapter\r\n  gem install rails-sqlserver-2000-2005-adapter -s http:&#047;&#047;gems.github.com\r\n  gem install dbd-odbc\r\n<\/pre>\n<p>The first step is the same as previously. The current gem now installs a Ruby-DBI gem &#8211; but the version without ADO.rb (dbi-0.4.1) &#8211; as well as the activerecord-sqlserver-adapter gem. <\/p>\n<p>The other two steps were taken from the <a href=\"http:\/\/wiki.rubyonrails.org\/database-support\/ms-sql\">Rails Wiki<\/a>. To be honest I&#8217;m not sure they are needed. <\/p>\n<p>I think the key step is this next one:<\/p>\n<p>I then went to the gems directory (C:&#092;ruby&#092;lib&#092;ruby&#092;gems&#092;1.8&#092;gems) and deleted dbi-0.4.1 directory, and replaced it with dbi-0.2.2 which I downloaded from <a href=\"http:\/\/rubyforge.org\/frs\/?group_id=234&#038;release_id=28765\">RubyForge<\/a>. My system then worked correctly.<\/p>\n<p>I&#8217;ve tried <strong>gem uninstall<\/strong> to remove dbi-0.4.1., but this doesn&#8217;t work. activerecord-sqlserver-adapter sees it as a dependant service and won&#8217;t work if dbi is uninstalled via gem uninstall. Deleting the folder works.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I noted the couple of steps I need to connect to a Microsoft SQL server in my Rails Tiddly Wiki under &#8220;MicrosoftSQL&#8221;. I&#8217;ve need to fire up a Rails development system on another PC and have found that the gems &hellip; <a href=\"http:\/\/nicholshayes.co.uk\/blog\/?p=104\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[],"_links":{"self":[{"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/104"}],"collection":[{"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=104"}],"version-history":[{"count":6,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/104\/revisions"}],"predecessor-version":[{"id":110,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/104\/revisions\/110"}],"wp:attachment":[{"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=104"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nicholshayes.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}