Getting Ruby to work with Postgres on Windows XP

Hi there,

I have postgres 8.2 installed (not from the source, just the installer)
and would like to get ruby to talk to my postgres databases simply. I
have ruby-postgres installed and am using the extconf.rb to install it,
but it is having problems finding the correct libraries and headers.

do I need to install postgres from source? or where am I supposed to
point it to?

Any help would be greatly appreciated.

D

I know that I should be using windows. But got no choice. :frowning:

Dillip Kumar wrote:

Hi there,

I have postgres 8.2 installed (not from the source, just the installer)
and would like to get ruby to talk to my postgres databases simply. I
have ruby-postgres installed and am using the extconf.rb to install it,
but it is having problems finding the correct libraries and headers.

do I need to install postgres from source? or where am I supposed to
point it to?

Any help would be greatly appreciated.

D

Dillip Kumar wrote:

Any help would be greatly appreciated.

D

If you’ve got Ruby from the one-click installer, you should be able to
install the gems for the PostgreSQL interface. If you’re behind a
firewall, you might need to have IT help you, but essentially, all you
need to do is open up the RubyGems command line gem installer that comes
with the one-click installer and install the gem(s).

There are two Ruby/PostgreSQL interface gems, one with some C language
code and one that is pure Ruby. Your problem indicates that you tried
the one with C code. I don’t have a Windows system with one-click handy,
but my recollection is that the gem for the C-language version is
pre-compiled for Windows.

I have never used either version, so I can’t comment on whether the pure
Ruby or the C-language version is “better” by any definition of the
word. But one way or another, if you use the one-click installer, you
should be able to get up and running via RubyGems without PostgreSQL
source.

I use postgres-pr gem and it works fine with rails. As I remember
optimized driver does not work on Windows.

When I want to connect without ActiveRecord (Rails) I use ruby DBI gem.

Both can be found on RubyForge.

by
TheR

Thank you both. Works great with postgres-pr.

I can’t wait till I get off this Windows box :slight_smile:

Dillip

Damjan R. wrote:

I use postgres-pr gem and it works fine with rails. As I remember
optimized driver does not work on Windows.

When I want to connect without ActiveRecord (Rails) I use ruby DBI gem.

Both can be found on RubyForge.

by
TheR

I use the “ruby-postgres-0.7.1.2006.04.06-mswin32” gem all the time, no
compiler required. I’ve never tried postgres-pr, but I would assume the
C extension would be a bit more performant. Why not install the binary
gem instead of trying to install from source?

Dillip Kumar wrote:

Thank you both. Works great with postgres-pr.

I can’t wait till I get off this Windows box :slight_smile:

Dillip

Damjan R. wrote:

I use postgres-pr gem and it works fine with rails. As I remember
optimized driver does not work on Windows.

When I want to connect without ActiveRecord (Rails) I use ruby DBI gem.

Both can be found on RubyForge.

by
TheR