[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

postgres database

Tom Allison

1/25/2006 2:15:00 AM

What is the file I need to require for connection to a postgres
database? DNS resolution?

How am I *supposed* to find this?
I didn't see anything in the Core or Standard library references.



11 Answers

Pat Maddox

1/25/2006 2:24:00 AM

0

You need to have the postgres adapter installed. I made a blog
post[1] that covers installation. It's pretty easy, just have to do a
few steps beyond the 'gem install postgres'. You can probably skip
the step to symlink libpq-fe.h because I think that's FreeBSD
specific. Naturally, you'll need to make sure you use the correct
paths for postgresql's include/lib dirs, where your gems are located,
etc.

Pat

[1] http://www.flpr.org/articles/2005/12/05/installing-the-postgr...


On 1/24/06, Tom Allison <tallison@tacocat.net> wrote:
> What is the file I need to require for connection to a postgres
> database? DNS resolution?
>
> How am I *supposed* to find this?
> I didn't see anything in the Core or Standard library references.
>
>
>


Dave Howell

1/26/2006 5:30:00 PM

0


On Jan 24, 2006, at 18:23, Pat Maddox wrote:

> You need to have the postgres adapter installed. I made a blog
> post[1] that covers installation. It's pretty easy, just have to do a
> few steps beyond the 'gem install postgres'. You can probably skip
> the step to symlink libpq-fe.h because I think that's FreeBSD
> specific. Naturally, you'll need to make sure you use the correct
> paths for postgresql's include/lib dirs, where your gems are located,
> etc.

A suggestion to the wider PostgreSQL-using Ruby populace; I was
somewhat confused until I figured out that I had to install at least
part of Postgres (bits of library files, I think) on the machine
running Ruby in order to talk to the database that's running on a
different system.

If somebody should happen to write/update/expand upon the instructions
for installing Postgres support into Ruby to include the case where the
Ruby code is being installed and/or running on a system without local
Postgres, that'd probably be a good thing . . . :) Maybe some way to
permanently bind the libraries into the gem-installed Ruby bits?

[Stop me if I start talking nonsense, I'm not entirely sure what I'm
talking about here.]



tsumeruby

1/26/2006 5:52:00 PM

0

On Friday 27 January 2006 02:30 am, Dave Howell wrote:
> A suggestion to the wider PostgreSQL-using Ruby populace; I was
> somewhat confused until I figured out that I had to install at least
> part of Postgres (bits of library files, I think) on the machine
> running Ruby in order to talk to the database that's running on a
> different system.
>
> If somebody should happen to write/update/expand upon the instructions
> for installing Postgres support into Ruby to include the case where the
> Ruby code is being installed and/or running on a system without local
> Postgres, that'd probably be a good thing . . . :) Maybe some way to
> permanently bind the libraries into the gem-installed Ruby bits?
>
> [Stop me if I start talking nonsense, I'm not entirely sure what I'm
> talking about here.]

Good suggestion, but it would be platform specific. Maybe this situation would
be best to create a pure ruby library. I see what you're saying. I think the
tile/tk packager is a direct solution, only if there was a packager for ruby
which would act this way.. To package in all the client libs built for many
platforms(Win, fbsd, linux, macosx), and package in to one small package.

Tsume


Dave Howell

1/26/2006 8:13:00 PM

0


On Jan 26, 2006, at 9:52, tsumeruby@tsumelabs.com wrote:

> On Friday 27 January 2006 02:30 am, Dave Howell wrote:
>
> To package in all the client libs built for many
> platforms(Win, fbsd, linux, macosx), and package in to one small
> package.

Not necessarily, I think. I just installed Postgres 8, so I don't think
I'd want Psql7.x libraries. (Or maybe they'd be fine.) I first tried
mounting the server's Postgres library directory, and then told the
gem-install script where it was, but it didn't actually copy them, it
just noted their location, so that failed the instant the mount went
down. Presumably, the code I have now is going to fail the instant I
move it to a different machine, unless I manage to scavenge up all the
various lint and popcorn flung far and wide in secret directories on my
system. {sigh}

But even just a mention of this minor pitfall would be good, I think.
All that's currently included is "You may have to tell the installer
where your postgres files are," without noting that you won't HAVE any
if you don't have a LOCAL install.

True self-contained binary-complete Ruby programs are apparently a much
more complicated project.




Wilson Bilkovich

1/26/2006 9:13:00 PM

0

On 1/26/06, Dave Howell <groups@grandfenwick.net> wrote:
>
> On Jan 24, 2006, at 18:23, Pat Maddox wrote:
>
> > You need to have the postgres adapter installed. I made a blog
> > post[1] that covers installation. It's pretty easy, just have to do a
> > few steps beyond the 'gem install postgres'. You can probably skip
> > the step to symlink libpq-fe.h because I think that's FreeBSD
> > specific. Naturally, you'll need to make sure you use the correct
> > paths for postgresql's include/lib dirs, where your gems are located,
> > etc.
>
> A suggestion to the wider PostgreSQL-using Ruby populace; I was
> somewhat confused until I figured out that I had to install at least
> part of Postgres (bits of library files, I think) on the machine
> running Ruby in order to talk to the database that's running on a
> different system.
>
> If somebody should happen to write/update/expand upon the instructions
> for installing Postgres support into Ruby to include the case where the
> Ruby code is being installed and/or running on a system without local
> Postgres, that'd probably be a good thing . . . :) Maybe some way to
> permanently bind the libraries into the gem-installed Ruby bits?
>
> [Stop me if I start talking nonsense, I'm not entirely sure what I'm
> talking about here.]
>

Personally, I just use the postgres-pr adapter, which is pure Ruby.
No dependencies, no compilation. Good stuff.


tsumeruby

1/26/2006 9:32:00 PM

0

On Friday 27 January 2006 05:13 am, Dave Howell wrote:
> On Jan 26, 2006, at 9:52, tsumeruby@tsumelabs.com wrote:
> > On Friday 27 January 2006 02:30 am, Dave Howell wrote:
> >
> > To package in all the client libs built for many
> > platforms(Win, fbsd, linux, macosx), and package in to one small
> > package.
>
> Not necessarily, I think. I just installed Postgres 8, so I don't think
> I'd want Psql7.x libraries. (Or maybe they'd be fine.) I first tried
> mounting the server's Postgres library directory, and then told the
> gem-install script where it was, but it didn't actually copy them, it
> just noted their location, so that failed the instant the mount went
> down. Presumably, the code I have now is going to fail the instant I
> move it to a different machine, unless I manage to scavenge up all the
> various lint and popcorn flung far and wide in secret directories on my
> system. {sigh}
>
> But even just a mention of this minor pitfall would be good, I think.
> All that's currently included is "You may have to tell the installer
> where your postgres files are," without noting that you won't HAVE any
> if you don't have a LOCAL install.
>
> True self-contained binary-complete Ruby programs are apparently a much
> more complicated project.

Have you tried the postgres-pr library? The library was brought to my
attention in another email.

Tsume


tsumeruby

1/27/2006 1:11:00 AM

0

On Friday 27 January 2006 06:46 am, Dave Howell wrote:
> On Jan 26, 2006, at 13:32, tsumeruby@tsumelabs.com wrote:
> > Have you tried the postgres-pr library? The library was brought to my
> > attention in another email.
>
> Yes, some months ago, but the installation failed utterly. I don't even
> recall what all I got in error messages. Also, I asked on this list a
> couple weeks ago which of the two (well, three, but two of them are the
> same thing with different names,) libraries to use, and was steered
> toward the non-pure-Ruby library.

I see it.. "postgres-ing? Too many choices!" I don't understand how one could
use a library over another just by someone making a comment, "AFAIK, it's not
as functional as the native extensions". Perhaps you should give the ruby
extension another shot, and post bug reports at any errors you receive. Pure
ruby solutions keep the sanity back in the programmer.

Tsume


Pat Maddox

1/27/2006 1:31:00 AM

0

On 1/26/06, tsumeruby@tsumelabs.com <tsumeruby@tsumelabs.com> wrote:
> On Friday 27 January 2006 06:46 am, Dave Howell wrote:
> > On Jan 26, 2006, at 13:32, tsumeruby@tsumelabs.com wrote:
> > > Have you tried the postgres-pr library? The library was brought to my
> > > attention in another email.
> >
> > Yes, some months ago, but the installation failed utterly. I don't even
> > recall what all I got in error messages. Also, I asked on this list a
> > couple weeks ago which of the two (well, three, but two of them are the
> > same thing with different names,) libraries to use, and was steered
> > toward the non-pure-Ruby library.
>
> I see it.. "postgres-ing? Too many choices!" I don't understand how one could
> use a library over another just by someone making a comment, "AFAIK, it's not
> as functional as the native extensions". Perhaps you should give the ruby
> extension another shot, and post bug reports at any errors you receive. Pure
> ruby solutions keep the sanity back in the programmer.
>
> Tsume
>
>

I asked Robby Russel, who really knows his stuff when it comes to
postgres, which adapter to use. He said "postgres from RubyGems works
nicely."

Pat


tsumeruby

1/27/2006 1:57:00 AM

0

On Friday 27 January 2006 10:31 am, Pat Maddox wrote:
> On 1/26/06, tsumeruby@tsumelabs.com <tsumeruby@tsumelabs.com> wrote:
> > On Friday 27 January 2006 06:46 am, Dave Howell wrote:
> > > On Jan 26, 2006, at 13:32, tsumeruby@tsumelabs.com wrote:
> > > > Have you tried the postgres-pr library? The library was brought to my
> > > > attention in another email.
> > >
> > > Yes, some months ago, but the installation failed utterly. I don't even
> > > recall what all I got in error messages. Also, I asked on this list a
> > > couple weeks ago which of the two (well, three, but two of them are the
> > > same thing with different names,) libraries to use, and was steered
> > > toward the non-pure-Ruby library.
> >
> > I see it.. "postgres-ing? Too many choices!" I don't understand how one
> > could use a library over another just by someone making a comment,
> > "AFAIK, it's not as functional as the native extensions". Perhaps you
> > should give the ruby extension another shot, and post bug reports at any
> > errors you receive. Pure ruby solutions keep the sanity back in the
> > programmer.
> >
> > Tsume
>
> I asked Robby Russel, who really knows his stuff when it comes to
> postgres, which adapter to use. He said "postgres from RubyGems works
> nicely."
>
> Pat

The issue is not about wether one library works better than the other. As long
as the library is functional is the most important. However, the original OP
was wanting to know a method for not having to compile postgres client
library on each platform. Of course the solution is a pure ruby
implementation.

Tsume


tsumeruby

1/27/2006 2:35:00 AM

0

On Friday 27 January 2006 11:05 am, Pat Maddox wrote:
> On 1/26/06, tsumeruby@tsumelabs.com <tsumeruby@tsumelabs.com> wrote:
> > On Friday 27 January 2006 10:31 am, Pat Maddox wrote:
> > > On 1/26/06, tsumeruby@tsumelabs.com <tsumeruby@tsumelabs.com> wrote:
> > > > On Friday 27 January 2006 06:46 am, Dave Howell wrote:
> > > > > On Jan 26, 2006, at 13:32, tsumeruby@tsumelabs.com wrote:
> > > > > > Have you tried the postgres-pr library? The library was brought
> > > > > > to my attention in another email.
> > > > >
> > > > > Yes, some months ago, but the installation failed utterly. I don't
> > > > > even recall what all I got in error messages. Also, I asked on this
> > > > > list a couple weeks ago which of the two (well, three, but two of
> > > > > them are the same thing with different names,) libraries to use,
> > > > > and was steered toward the non-pure-Ruby library.
> > > >
> > > > I see it.. "postgres-ing? Too many choices!" I don't understand how
> > > > one could use a library over another just by someone making a
> > > > comment, "AFAIK, it's not as functional as the native extensions".
> > > > Perhaps you should give the ruby extension another shot, and post bug
> > > > reports at any errors you receive. Pure ruby solutions keep the
> > > > sanity back in the programmer.
> > > >
> > > > Tsume
> > >
> > > I asked Robby Russel, who really knows his stuff when it comes to
> > > postgres, which adapter to use. He said "postgres from RubyGems works
> > > nicely."
> > >
> > > Pat
> >
> > The issue is not about wether one library works better than the other. As
> > long as the library is functional is the most important. However, the
> > original OP was wanting to know a method for not having to compile
> > postgres client library on each platform. Of course the solution is a
> > pure ruby
> > implementation.
> >
> > Tsume
>
> It's not an issue? A native adapter is going to be faster than the
> pure ruby adapter.
well yeah, the ruby version is going to be slower.

> Not sure how you came up with "the OP was wanting
> to know a method for not having to compile postres client library on
> each platform."

Erm, *smile*. I guess I started with 177137 and thought it was the OP.
/me runs around, "I'm blind, I'm blind! *hits wall*"

Tsume

>
> Here's the original question:
>
> "What is the file I need to require for connection to a postgres
> database? DNS resolution?
>
> How am I *supposed* to find this?
> I didn't see anything in the Core or Standard library references."