Forum: Ruby Ruby + Postgresql

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Tom Allison (Guest)
on 2006-06-14 02:18
(Received via mailing list)
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.
Anton 'tony' Bangratz (Guest)
on 2006-06-14 12:16
(Received via mailing list)
Tom Allison 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.
Tom Allison (Guest)
on 2006-06-14 14:52
(Received via mailing list)
Thank you very much.
I didn't even know I could to an 'aptitude show...'.

Wow, the things I learn...
This topic is locked and can not be replied to.