Forum: Ruby postgres database

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.
201ab62b10b1ce61759a091d3b307fa1?d=identicon&s=25 Tom Allison (Guest)
on 2006-01-25 03:16
(Received via mailing list)
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.
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-01-25 03:25
(Received via mailing list)
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...
12271b6df73fe29930d65586be5a4a70?d=identicon&s=25 Dave Howell (Guest)
on 2006-01-26 18:31
(Received via mailing list)
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.]
19f65b7dca6831edf989224b5ebd3fe0?d=identicon&s=25 unknown (Guest)
on 2006-01-26 18:52
(Received via mailing list)
On Friday 27 January 2006 02:30 am, Dave Howell wrote:
> 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
12271b6df73fe29930d65586be5a4a70?d=identicon&s=25 Dave Howell (Guest)
on 2006-01-26 21:13
(Received via mailing list)
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.
25e11a00a89683f7e01e425a1a6e305c?d=identicon&s=25 Wilson Bilkovich (Guest)
on 2006-01-26 22:14
(Received via mailing list)
On 1/26/06, Dave Howell <groups@grandfenwick.net> wrote:
>
> 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.
19f65b7dca6831edf989224b5ebd3fe0?d=identicon&s=25 unknown (Guest)
on 2006-01-26 22:32
(Received via mailing list)
On Friday 27 January 2006 05:13 am, Dave Howell wrote:
> gem-install script where it was, but it didn't actually copy them, it
>
> 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
12271b6df73fe29930d65586be5a4a70?d=identicon&s=25 Dave Howell (Guest)
on 2006-01-26 22:47
(Received via mailing list)
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.
19f65b7dca6831edf989224b5ebd3fe0?d=identicon&s=25 unknown (Guest)
on 2006-01-27 02:13
(Received via mailing list)
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
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-01-27 02:34
(Received via mailing list)
On 1/26/06, tsumeruby@tsumelabs.com <tsumeruby@tsumelabs.com> wrote:
>
> 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
19f65b7dca6831edf989224b5ebd3fe0?d=identicon&s=25 unknown (Guest)
on 2006-01-27 02:58
(Received via mailing list)
On Friday 27 January 2006 10:31 am, Pat Maddox wrote:
> > > toward the non-pure-Ruby library.
> 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
42172acdf3c6046f84d644cb0b94642c?d=identicon&s=25 Pat Maddox (pergesu)
on 2006-01-27 03:07
(Received via mailing list)
On 1/26/06, tsumeruby@tsumelabs.com <tsumeruby@tsumelabs.com> wrote:
> > > > same thing with different names,) libraries to use, and was steered
> >
> implementation.
>
> Tsume
>
>

It's not an issue?  A native adapter is going to be faster than the
pure ruby adapter.  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."

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."
19f65b7dca6831edf989224b5ebd3fe0?d=identicon&s=25 unknown (Guest)
on 2006-01-27 03:37
(Received via mailing list)
On Friday 27 January 2006 11:05 am, Pat Maddox wrote:
> > > > > list a couple weeks ago which of the two (well, three, but two of
> > > > Tsume
> > 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
12271b6df73fe29930d65586be5a4a70?d=identicon&s=25 Dave Howell (Guest)
on 2006-01-31 22:08
(Received via mailing list)
On Jan 26, 2006, at 18:05, Pat Maddox wrote:

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

But he wasn't responding to the original question, but rather, to MY
comment that there was a missing caveat for the non-pure-Ruby version;
that you had to have the libraries installed somewhere, which means
either that you have to have a local installation of Postgres (whether
the database is local or not), or you have to somehow manually relocate
said libraries, and tell the installer where you put them.

You do NOT have to *compile* Postgres; you just need the libraries.

Or you need an implementation that doesn't use them. I didn't install
the pure Ruby version because (a) I'd tried it once before and had the
install fail, and (b) I didn't _know_ that I'd have to fiddle around
with copying the postgres library files over to my laptop until I tried
installing the native-code Ruby/Postgres gem.

I have now done so, so I'm probably not going to try installing a
different gem unless I have to. Ruby programs under OSX are already
horribly non-portable (it's amazing what doesn't fly under default Ruby
1.6.8/OSX 10.3 vis a vis Ruby 1.8.?, never mind the various whateverses
I've installed, like the Postgres gem), so I'll just have to see how
well standaloneify.rb works for giving me binary-complete Ruby apps.
This topic is locked and can not be replied to.