# Activerecord sql server frustrations

**URL:** <https://www.ruby-forum.com/t/activerecord-sql-server-frustrations/186360>\
**Category:** Rails\
**Created:** [April 5, 2010, 7:29pm UTC](https://www.ruby-forum.com/t/activerecord-sql-server-frustrations/186360 "2010-04-05T19:29:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![stewbawka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@stewbawka](https://www.ruby-forum.com/u/stewbawka)\
**Post date:** [April 5, 2010, 7:29pm UTC](https://www.ruby-forum.com/t/activerecord-sql-server-frustrations/186360/1 "2010-04-05T19:29:36Z")

</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](http://ADO.NET).

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

development:  
adapter: sqlserver  
mode: odbc  
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:** ![stewbawka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@stewbawka](https://www.ruby-forum.com/u/stewbawka)\
**Post date:** [April 5, 2010, 7:44pm UTC](https://www.ruby-forum.com/t/activerecord-sql-server-frustrations/186360/2 "2010-04-05T19:44:49Z")

</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:** ![stewbawka](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/a9adbd/32.png) [@stewbawka](https://www.ruby-forum.com/u/stewbawka)\
**Post date:** [April 5, 2010, 9:29pm UTC](https://www.ruby-forum.com/t/activerecord-sql-server-frustrations/186360/3 "2010-04-05T21:29:01Z")

</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)
