Ken-ichi (ken_ichi) wrote in ruby_lang,
Ken-ichi
ken_ichi
ruby_lang

Newbie trying to connect to a postgres database

Hi all. I'm just getting started with Ruby (coming from PHP), and I'm having trouble connecting to a PostgreSQL database. I'm using the ruby-postgres extension library, but I can't even get PGconn to work. The example given on the rdoc site says to use the 'open' method, which doesn't work. The 'new' method does, but not with a hash of connection paramters, as documented.

I guess what I'd like to know is if there's a better way to work with Postgres from within Ruby, and if anyone can recommend some working example code or a tutorial, since the docs don't seem to be complete or accurate or something.
  • Post a new comment

    Error

    default userpic
  • 4 comments