Ruby, dbi and PostgreSQL

Penty Wenngren penty.wenngren at dgc.se
Thu Nov 12 00:17:20 UTC 2009


On Wed, Nov 11, 2009 at 07:26:31PM +0100, Dirk Meyer wrote:
> 
> In der Nachricht vom 11.11.09 17:06 Uhr
> schrieb penty.wenngren at dgc.se (Penty Wenngren)
> unter dem Betreff: 'Ruby, dbi and PostgreSQL'
> 
> > After having upgraded our installed ports this morning we have a few
> > machines that no longer want to play with ruby, dbi and postgres. This
> > is the output I get when trying to do this in irb:
> > 
> > irb(main):001:0> require 'dbi'
> > => true
> > irb(main):002:0> dbh = DBI.connect("DBI:Pg:test","test","test")
> > DBI::InterfaceError: Could not load driver (Could not find driver Pg or pg (error:
> > no such file to load -- pg))
> >     from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:318:in `load_driver'
> >     from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:160:in `_get_full_driver'
> >     from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:145:in `connect'
> >     from (irb):2
> 
> Please try to add before require 'dbi':
> 
> require 'rubygems'
> 
> This should fix the problem.
> Please report back.
> 
> 

Hello Dirk,

Thank you for your answer. I tried what you suggested, but it doesn't
seem to make any difference:

irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'dbi'
=> true
irb(main):003:0> dbh = DBI.connect("DBI:Pg:test","test","test")
DBI::InterfaceError: Could not load driver (Could not find driver Pg or
pg (error: no such file to load -- pg))
	from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:318:in
`load_driver'
	from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:160:in
`_get_full_driver'
	from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:145:in `connect'
	from (irb):3


Sorry, forgot to report the system I'm running on. They are all 7.1, two
of them are running amd64 and one is running i386. All having the same
problem. Before the last portupgrade everything was running fine, so I'm
inclined to believe something was changed with the latest updates to
ruby's dbi, but I may of course be wrong :)

// Penty

-- 

Penty Wenngren
DGC Solutions AB


More information about the freebsd-ruby mailing list