Ruby + Postgresql

First, I installed DBD/DBI for my Debian box and I’m not finding
anything that looks like ri docs. I haven’t any idea what to do about
this and am hoping that maybe it will just go away for now. I doubt it
will.

I don’t know if this is a Debian problem or what. So I’m putting it
aside for now.

What I would like to know is how to connect to a postgres database
that’s located on a TCP/IP connection (on another machine). So far, the
docs I can find are a little vague on this department or are all about
MySQL which doesn’t really help.

Tom A. wrote:

First, I installed DBD/DBI for my Debian box and I’m not finding
anything that looks like ri docs. I haven’t any idea what to do about
this and am hoping that maybe it will just go away for now. I doubt it
will.

I don’t know if this is a Debian problem or what. So I’m putting it
aside for now.

It is a Debian annoyance, the output of ‘aptitude show ruby1.8’ states
clearly:

On Debian, Ruby 1.8 is provided as separate packages. You can get
full Ruby 1.8 distribution by installing following packages.

ruby1.8 ruby1.8-dev ri1.8 rdoc1.8 irb1.8 ruby1.8-elisp
ruby1.8-examples libdbm-ruby1.8 libgdbm-ruby1.8 libtcltk-ruby1.8
libopenssl-ruby1.8 libreadline-ruby1.8

This information can be found on various sites, and even with
searching the mailing list archives for ‘debian’ and ‘ruby’.

Other packages you might want to install are

libdbi-ruby1.8
libdbd-pg-ruby1.8

What I would like to know is how to connect to a postgres database
that’s located on a TCP/IP connection (on another machine). So far, the
docs I can find are a little vague on this department or are all about
MySQL which doesn’t really help.

It’s only about replacing ‘MySQL’ with ‘Pg’:

dbh = DBI.connect(‘DBI:Pg:test:hostname’, ‘user’, ‘password’)

alternatively

dbh = DBI.connect(‘DBI:Pg:database=test;host=hostname’,
‘user’,‘password’)

HTH,

t.

Thank you very much.
I didn’t even know I could to an ‘aptitude show…’.

Wow, the things I learn…