Forum: Ruby ruby odbc

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Uwe K. (Guest)
on 2007-07-02 18:22
(Received via mailing list)
Hi all!

I am trying to use ActiveRecord migrations from Linux on an MS SQL
Server database running on windows.  I am following the instructions on

http://wiki.rubyonrails.org/rails/pages/HowtoConne...


I have successfully set up freetds and unixODBC, and I can connect fine
using tsql and isql.

When I try connecting using ruby I get the following:

[root@pippin laptop_scripts]# irb
irb(main):001:0> require 'odbc'
=> true
irb(main):002:0> require 'dbi'
=> true
irb(main):003:0> dbh = DBI.connect('dbi:ODBC:database_name', 'username',
'password')
NoMethodError: undefined method `default_attributes' for
#<ODBC::Driver:0xb7f6ade4 @attrs={}, @name=nil>
        from /usr/lib/ruby/site_ruby/1.8/dbi.rb:420:in `connect'
        from /usr/lib/ruby/site_ruby/1.8/dbi.rb:215:in `connect'
        from (irb):3
irb(main):004:0>

Checking the ruby odbc documentation, the default_attributes method is
not defined, and the Driver class inherits from Object.

Can anybody help tell me what to do to connect using DBI?

All help is greatly appreciated.


Uwe
Gale C. (Guest)
on 2007-07-04 15:13
> http://wiki.rubyonrails.org/rails/pages/HowtoConne...
>
>
> I have successfully set up freetds and unixODBC, and I can connect fine
> using tsql and isql.
>


Did you install Ruby ODBC and Ruby DBI ODBC driver after testing on tsql
and isql, like the page mentions ?
Uwe K. (Guest)
on 2007-07-04 19:49
(Received via mailing list)
On Wed, 2007-07-04 at 20:18 +0900, Gale CC wrote:
> > 
http://wiki.rubyonrails.org/rails/pages/HowtoConne...
> >
> > I have successfully set up freetds and unixODBC, and I can connect fine
> > using tsql and isql.

> Did you install Ruby ODBC and Ruby DBI ODBC driver after testing on tsql
> and isql, like the page mentions ?

Thank you for answering.

It turns out I had forgotten to add the --with=dbd_odbc option when
running the setup config script during the Ruby DBI installation.  When
I added the option, everything worked.

Thanks again for answering.


Uwe
This topic is locked and can not be replied to.