postgres database

Discussion in 'Ruby' started by Tom Allison, Jan 25, 2006.

  1. Tom Allison

    Tom Allison Guest

    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.
     
    Tom Allison, Jan 25, 2006
    #1
    1. Advertising

  2. Tom Allison

    Pat Maddox Guest

    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


    On 1/24/06, Tom Allison <> 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.
    >
    >
    >
     
    Pat Maddox, Jan 25, 2006
    #2
    1. Advertising

  3. Tom Allison

    Dave Howell Guest

    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.]
     
    Dave Howell, Jan 26, 2006
    #3
  4. Tom Allison

    Guest

    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
     
    , Jan 26, 2006
    #4
  5. Tom Allison

    Dave Howell Guest

    On Jan 26, 2006, at 9:52, 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.
     
    Dave Howell, Jan 26, 2006
    #5
  6. On 1/26/06, Dave Howell <> 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.
     
    Wilson Bilkovich, Jan 26, 2006
    #6
  7. Tom Allison

    Guest

    On Friday 27 January 2006 05:13 am, Dave Howell wrote:
    > On Jan 26, 2006, at 9:52, 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
     
    , Jan 26, 2006
    #7
  8. Tom Allison

    Guest

    On Friday 27 January 2006 06:46 am, Dave Howell wrote:
    > On Jan 26, 2006, at 13:32, 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
     
    , Jan 27, 2006
    #8
  9. Tom Allison

    Pat Maddox Guest

    On 1/26/06, <> wrote:
    > On Friday 27 January 2006 06:46 am, Dave Howell wrote:
    > > On Jan 26, 2006, at 13:32, 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 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
     
    Pat Maddox, Jan 27, 2006
    #9
  10. Tom Allison

    Guest

    On Friday 27 January 2006 10:31 am, Pat Maddox wrote:
    > On 1/26/06, <> wrote:
    > > On Friday 27 January 2006 06:46 am, Dave Howell wrote:
    > > > On Jan 26, 2006, at 13:32, 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
     
    , Jan 27, 2006
    #10
  11. Tom Allison

    Guest

    On Friday 27 January 2006 11:05 am, Pat Maddox wrote:
    > On 1/26/06, <> wrote:
    > > On Friday 27 January 2006 10:31 am, Pat Maddox wrote:
    > > > On 1/26/06, <> wrote:
    > > > > On Friday 27 January 2006 06:46 am, Dave Howell wrote:
    > > > > > On Jan 26, 2006, at 13:32, 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."
     
    , Jan 27, 2006
    #11
  12. Tom Allison

    Dave Howell Guest

    On Jan 26, 2006, at 18:05, Pat Maddox wrote:

    > On 1/26/06, <> wrote:
    >>
    >> 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. 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.
     
    Dave Howell, Jan 31, 2006
    #12
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sam
    Replies:
    2
    Views:
    1,586
    Wm. G. Urquhart
    Jul 10, 2003
  2. K S Aldebaraan

    getDate() method and postgres datatype

    K S Aldebaraan, Aug 15, 2003, in forum: Java
    Replies:
    4
    Views:
    13,490
    K S Aldebaraan
    Aug 22, 2003
  3. Ravi
    Replies:
    0
    Views:
    454
  4. Nick Black
    Replies:
    1
    Views:
    164
    Kashia Buch
    Nov 16, 2006
  5. Gian Holland

    existing postgres database

    Gian Holland, Aug 28, 2007, in forum: Ruby
    Replies:
    0
    Views:
    92
    Gian Holland
    Aug 28, 2007
Loading...

Share This Page