# Problems with sqlserver 2000 and ActiveRecord

**URL:** <https://www.ruby-forum.com/t/problems-with-sqlserver-2000-and-activerecord/126340>\
**Category:** Rails\
**Created:** [January 17, 2008, 3:22pm UTC](https://www.ruby-forum.com/t/problems-with-sqlserver-2000-and-activerecord/126340 "2008-01-17T15:22:53Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Miguel\_angel\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b487fb/32.png) [@Miguel\_angel\_G](https://www.ruby-forum.com/u/Miguel_angel_G)\
**Post date:** [January 17, 2008, 3:22pm UTC](https://www.ruby-forum.com/t/problems-with-sqlserver-2000-and-activerecord/126340/1 "2008-01-17T15:22:53Z")

</div>

Hi,

I’m getting some trouble in connecting to a sql server 2000  
database with ActiveRecord-2.0.1 and ruby 186-26, from  
win XP.

Using the next conenction config:

ActiveRecord::Base.establish\_connection(  
:adapter =\> “sqlserver”,  
:database =\> “nombre\_bd”,  
:username =\> “usu”,  
:password =\> “contra”  
)

I have the next error:

C:/ruby/lib/ruby/site\_ruby/1.8/dbi.rb:329:in `load\_driver’: Unable to  
load driver ‘ADO’ (DBI::InterfaceError)

I don’t understand whre’s the matter, i have installed the client tools  
of sql server 2000 and 2005, and i have installed visual studio 2005  
too (i should have installed the sql server ado provider).

If i try using ODBC, neither works. I can connect to database, and some  
querys work, but in a quey i get a memory error:

C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.1/lib/active\_record/connection\_a  
dapters/abstract\_adapter.rb:150:in `log’: NoMemoryError: negative  
allocation siz  
e (or too big): SELECT \* FROM si\_Empresas WHERE  
(si\_Empresas.[IdEmpresa] = 227  
2) (ActiveRecord::StatementInvalid)

Any idea will be appreciated,

Regards

Saludos

---

<div class="post-metadata">

**Author:** ![Miguel\_angel\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b487fb/32.png) [@Miguel\_angel\_G](https://www.ruby-forum.com/u/Miguel_angel_G)\
**Post date:** [January 17, 2008, 4:11pm UTC](https://www.ruby-forum.com/t/problems-with-sqlserver-2000-and-activerecord/126340/2 "2008-01-17T16:11:00Z")

</div>

See this to solve the DBI problem - sounds like you’re missing a file.

[http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer](http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer)

As for ODBC, I have no idea what’s wrong there - we use it constantly  
here  
from Linux or Windows with no problems. On Windows, ADO seems to perform  
better for us though.

On Jan 17, 2008 8:22 AM, Miguel angel Garcia roig \<

---

<div class="post-metadata">

**Author:** ![Miguel\_angel\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b487fb/32.png) [@Miguel\_angel\_G](https://www.ruby-forum.com/u/Miguel_angel_G)\
**Post date:** [January 17, 2008, 5:28pm UTC](https://www.ruby-forum.com/t/problems-with-sqlserver-2000-and-activerecord/126340/3 "2008-01-17T17:28:45Z")

</div>

Thank you,

It is working now.

It’s an strange issue, i amb working with ActiveRecord-2, but  
my ruby installation does not had any ADO class (ADO.rb file).

I have downloaded the last dbi package, and copied to my ruby  
install, and works.

Regards

Brian H. wrote:

> See this to solve the DBI problem - sounds like you’re missing a file.
> 
> [http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer](http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer)
> 
> As for ODBC, I have no idea what’s wrong there - we use it constantly  
> here  
> from Linux or Windows with no problems. On Windows, ADO seems to perform  
> better for us though.
> 
> On Jan 17, 2008 8:22 AM, Miguel angel Garcia roig \<

---

<div class="post-metadata">

**Author:** ![Miguel\_angel\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b487fb/32.png) [@Miguel\_angel\_G](https://www.ruby-forum.com/u/Miguel_angel_G)\
**Post date:** [March 12, 2008, 9:19am UTC](https://www.ruby-forum.com/t/problems-with-sqlserver-2000-and-activerecord/126340/4 "2008-03-12T09:19:51Z")

</div>

Hi,

I have the same trouble.

I do :  
ruby setup.rb config --with=dbi  
ruby setup.rb setup  
ruby setup.rb install

But I don’t understand where to put the package of DBI ?

Unarchive it in the lib of ruby ?  
Copy directly the archive in the lib ?  
Is there any command to execute after that ?

Regards.

Miguel angel Garcia roig wrote:

> Thank you,
> 
> It is working now.
> 
> It’s an strange issue, i amb working with ActiveRecord-2, but  
> my ruby installation does not had any ADO class (ADO.rb file).
> 
> I have downloaded the last dbi package, and copied to my ruby  
> install, and works.
> 
> Regards
> 
> Brian H. wrote:
> 
> > See this to solve the DBI problem - sounds like you’re missing a file.
> > 
> > [http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer](http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer)
> > 
> > As for ODBC, I have no idea what’s wrong there - we use it constantly  
> > here  
> > from Linux or Windows with no problems. On Windows, ADO seems to perform  
> > better for us though.
> > 
> > On Jan 17, 2008 8:22 AM, Miguel angel Garcia roig \<

---

<div class="post-metadata">

**Author:** ![Miguel\_angel\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b487fb/32.png) [@Miguel\_angel\_G](https://www.ruby-forum.com/u/Miguel_angel_G)\
**Post date:** [March 12, 2008, 10:27am UTC](https://www.ruby-forum.com/t/problems-with-sqlserver-2000-and-activerecord/126340/5 "2008-03-12T10:27:00Z")

</div>

Hi,

You should download the last ruby-dbi package from

[http://rubyforge.org/projects/ruby-dbi/](http://rubyforge.org/projects/ruby-dbi/)

uncompress it and copy the file lib/dbd/ADO.rb  
to your ruby install, in

/ruby/lib/ruby/site\_ruby/1.8/DBD/ADO/ADO.rb

(make directories as required to create the full path)

Regards

FrÃ©dÃ©rick Fredo wrote:

> Hi,
> 
> I have the same trouble.
> 
> I do :  
> ruby setup.rb config --with=dbi  
> ruby setup.rb setup  
> ruby setup.rb install
> 
> But I don’t understand where to put the package of DBI ?
> 
> Unarchive it in the lib of ruby ?  
> Copy directly the archive in the lib ?  
> Is there any command to execute after that ?
> 
> Regards.
> 
> Miguel angel Garcia roig wrote:
> 
> > Thank you,
> > 
> > It is working now.
> > 
> > It’s an strange issue, i amb working with ActiveRecord-2, but  
> > my ruby installation does not had any ADO class (ADO.rb file).
> > 
> > I have downloaded the last dbi package, and copied to my ruby  
> > install, and works.
> > 
> > Regards
> > 
> > Brian H. wrote:
> > 
> > > See this to solve the DBI problem - sounds like you’re missing a file.
> > > 
> > > [http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer](http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer)
> > > 
> > > As for ODBC, I have no idea what’s wrong there - we use it constantly  
> > > here  
> > > from Linux or Windows with no problems. On Windows, ADO seems to perform  
> > > better for us though.
> > > 
> > > On Jan 17, 2008 8:22 AM, Miguel angel Garcia roig \<

---

<div class="post-metadata">

**Author:** ![Miguel\_angel\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b487fb/32.png) [@Miguel\_angel\_G](https://www.ruby-forum.com/u/Miguel_angel_G)\
**Post date:** [March 12, 2008, 2:39pm UTC](https://www.ruby-forum.com/t/problems-with-sqlserver-2000-and-activerecord/126340/6 "2008-03-12T14:39:35Z")

</div>

WebRick is getting an error :  
e:/soft/ruby/lib/ruby/site\_ruby/1.8/DBD/ADO/ADO.rb:469: syntax error,  
unexpected ‘\n’, expecting tCOLON2 or ‘.’

I’ve tried different versions with different downloads but it’s always  
the same error.

Thanks

Can someone attach its ADO.rb file.

---

<div class="post-metadata">

**Author:** ![Miguel\_angel\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/b487fb/32.png) [@Miguel\_angel\_G](https://www.ruby-forum.com/u/Miguel_angel_G)\
**Post date:** [November 9, 2009, 4:46am UTC](https://www.ruby-forum.com/t/problems-with-sqlserver-2000-and-activerecord/126340/7 "2009-11-09T04:46:24Z")

</div>

Miguel angel Garcia roig wrote:

> ActiveRecord::Base.establish\_connection(  
> :adapter =\> “sqlserver”,  
> :database =\> “nombre\_bd”,  
> :username =\> “usu”,  
> :password =\> “contra”  
> )

Try changing the keys to this parameter list:

ActiveRecord::Base.establish\_connection(  
:adapter =\> “sqlserver”,  
:username =\> “usu”,  
:password =\> “contra”  
:dsn =\> nombre\_bd,  
:mode =\> ‘ODBC’  
)

~glr
