Ruby, dbi and PostgreSQL

Penty Wenngren penty.wenngren at dgc.se
Mon Nov 16 15:45:36 UTC 2009


On Mon, Nov 16, 2009 at 04:17:48PM +0100, Dirk Meyer wrote:
> Hallo Penty Wenngren,
> 
> > 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
>  
> The short name never worked for me even before the update.
> Do you have a setup where it worked this way?
> 

Yes, we actually have a whole bunch of scripts with the short name that
worked until the upgrade last week.

> I used for some years this form and I tested it:
> dbh = DBI.connect("DBI:Pg:dbname=mydb","user","secret")
> 

I will have that in mind. Better safe than sorry, so I will convert the
connection strings in our scripts to use that form instead. I tried the
same connection string as before, but with dbname=mydb instead, and I
get the same error message.

// Penty

-- 

Penty Wenngren
DGC Solutions AB


More information about the freebsd-ruby mailing list