Problems with sqlserver 2000 and ActiveRecord

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

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

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 <

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

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 <

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

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 <

Hi,

You should download the last ruby-dbi package from

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

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 <

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.

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