 |
Forums |
Admin Start New Thread
| Message: 97261 |
 |
BY: Al Adolfsen (aladolfsen) DATE: 2011-12-16 18:10 SUBJECT: DBI.Connect I've tried looking on web and cannot get answer. I am getting an error while attempting to connect to various databases using ODBC. Regardless of the database, I get the following error:
DBI::InterfaceError: Unable to load driver 'ODBC' (underlying error: uninitialized constant DBI::DBD::ODBC)
I've created ODBC datasources,and have used these ODBC connections in the past with other languages. However, I cannot get them to work with DBI. I have connected using WIN32OLE.new('ADODB.Connection') with ruby, but I would like to see how DBI works.
Below shows the gems installed and the irb sessions with errors. Can anyone help?
C:\Users\adolfsena>gem list dbd-odbc -d
*** LOCAL GEMS ***
dbd-odbc (0.2.5)
Authors: Erik Hollensbe, Christopher Maujean
Rubyforge: http://rubyforge.org/projects/ruby-dbi
Homepage: http://www.rubyforge.org/projects/ruby-dbi
Installed at: C:/Ruby193/lib/ruby/gems/1.9.1
ODBC DBI DBD
C:\Users\adolfsena>gem list dbi -d
*** LOCAL GEMS ***
dbi (0.4.5)
Authors: Erik Hollensbe, Christopher Maujean
Rubyforge: http://rubyforge.org/projects/ruby-dbi
Homepage: http://www.rubyforge.org/projects/ruby-dbi
Installed at: C:/Ruby193/lib/ruby/gems/1.9.1
A vendor independent interface for accessing databases, similar to
Perl's DBI
C:\Users\adolfsena>irb
irb(main):001:0> require 'dbi'
=> true
irb(main):002:0> conn = DBI.connect("DBI:ODBC:my2009", "data", "data")
DBI::InterfaceError: Unable to load driver 'ODBC' (underlying error: uninitialized constant DBI::DBD::ODBC)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in load_driver'
from C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
from (irb):2
from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):003:0> conn = DBI.connect('DBI:ODBC:Chesbill', 'Admin', '')
DBI::InterfaceError: Unable to load driver 'ODBC' (underlying error: uninitialized constant DBI::DBD::ODBC)
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in load_driver'
from C:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect'
from (irb):3
from C:/Ruby193/bin/irb:12:in `<main>'
irb(main):004:0> exit
Note I am running on Windows 7. | |
Thread View
Post a followup to this message
|
 |