postgres database

T

Tom Allison

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.
 
P

Pat Maddox

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-postgres-adapter
 
D

Dave Howell

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.]
 
T

tsumeruby

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
 
D

Dave Howell

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.
 
W

Wilson Bilkovich

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.
 
T

tsumeruby

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
 
T

tsumeruby

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
 
P

Pat Maddox

I see it.. "postgres-ing? Too many choices!" I don't understand how one c= ould
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. P= ure
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
 
T

tsumeruby

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
 
T

tsumeruby

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
 
D

Dave Howell

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?

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top