Ruby, dbi and PostgreSQL

Penty Wenngren penty.wenngren at dgc.se
Mon Nov 16 15:09:10 UTC 2009


On Sun, Nov 15, 2009 at 10:56:06AM +0100, Dirk Meyer wrote:
> 
> > 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
>  
> The update to ruby18-dbd_pg-0.3.8 is wrong.
> seems that my patches where not commited.
> I will merge my patches and commit the necessary fixes.
> 
> > ruby18-dbd_pg-0.3.8
> 


Thanks Dirk, it seems your patches solved that problem. However, now I get
another error message instead:

$ irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'dbi'
=> true
irb(main):003:0> dbh = DBI.connect("DBI:Pg:mydb","user","secret")
DBI::OperationalError: can't format
        from /usr/local/lib/ruby/site_ruby/1.8/dbd/pg/database.rb:82:in
`initialize'
        from /usr/local/lib/ruby/site_ruby/1.8/dbd/Pg.rb:157:in `new'
        from /usr/local/lib/ruby/site_ruby/1.8/dbd/Pg.rb:157:in `connect'
        from /usr/local/lib/ruby/site_ruby/1.8/dbi/handles/driver.rb:33:in
`connect'
        from /usr/local/lib/ruby/site_ruby/1.8/dbi.rb:148:in `connect'
        from (irb):3


// Penty

-- 

Penty Wenngren
DGC Solutions AB


More information about the freebsd-ruby mailing list