# activerecord sql server frustrations

**URL:** <https://discuss.rubyonrails.org/t/activerecord-sql-server-frustrations/50675>\
**Category:** rubyonrails-talk\
**Created:** [April 5, 2010, 5:28pm UTC](https://discuss.rubyonrails.org/t/activerecord-sql-server-frustrations/50675 "2010-04-05T17:28:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stuart\_Wade](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Stuart\_Wade](https://discuss.rubyonrails.org/u/Stuart_Wade)\
**Post date:** [April 5, 2010, 5:28pm UTC](https://discuss.rubyonrails.org/t/activerecord-sql-server-frustrations/50675/1 "2010-04-05T17:28:27Z")

</div>

First off, i'm on ubuntu trying to connect to sql server 2008..

I installed the latest version of the activerecord-sqlserver-adapter gem (2.3.4). in my database.yml i first tried connecting with the mode: ADO, but got this message:

Please use version 2.3.1 of the adapter for ADO connections. Future versions may support ADO.NET.

Ok.. so i try swapping my database.yml with this:

development: &nbsp;&nbsp;adapter: sqlserver &nbsp;&nbsp;mode: odbc &nbsp;&nbsp;dsn: Driver={SQL Server Native Client};Server=xxx.xx.x.xxx;Database=testing;Uid=sa;Pwd=\*\*\*\*\*\*\*;

now i get this message when i try to db:migrate:

S1090 (0) [unixODBC][Driver Manager]Invalid string or buffer length

i did a gem install for odbc-rails, but still getting the same. trying to find solutions on the net is frustrating because there's such a mix of different ways to connect (ado, odbc, dbi, etc) and some are from the perspective of connecting from windows or mac osx.. to compound things a lot of the stuff is older so i'm constantly wondering if there's a new better way..

i'm used to connecting to mysql painlessly.. i don't know much about odbc, dbi, ado or any of that. i just want to know what the best and most current way to connect to a sql server db is.

Help me please! I just want to start coding!

Stuart

---

<div class="post-metadata">

**Author:** ![MattUebel](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@MattUebel](https://discuss.rubyonrails.org/u/MattUebel)\
**Post date:** [April 5, 2010, 5:42pm UTC](https://discuss.rubyonrails.org/t/activerecord-sql-server-frustrations/50675/2 "2010-04-05T17:42:50Z")

</div>

Unfortunately I have no advice to offer, but I can say that I am mightily interested in this question. I will undoubtedly be trying to hook up to a MSSQL DB at some point, and everything I have read so far looks INCREDIBLY painful. ☹

Good luck.

---

<div class="post-metadata">

**Author:** ![Stuart\_Wade](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@Stuart\_Wade](https://discuss.rubyonrails.org/u/Stuart_Wade)\
**Post date:** [April 5, 2010, 7:27pm UTC](https://discuss.rubyonrails.org/t/activerecord-sql-server-frustrations/50675/3 "2010-04-05T19:27:50Z")

</div>

Finally some luck!!!

I followed this and finally got my migration to run:

[http://wiki.rubyonrails.org/database-support/ms-sql#dsn-less\_connection](http://wiki.rubyonrails.org/database-support/ms-sql#dsn-less_connection)
