# Getting Ruby to work with Postgres on Windows XP

**URL:** <https://www.ruby-forum.com/t/getting-ruby-to-work-with-postgres-on-windows-xp/121005>\
**Category:** Ruby\
**Created:** [November 22, 2007, 4:15pm UTC](https://www.ruby-forum.com/t/getting-ruby-to-work-with-postgres-on-windows-xp/121005 "2007-11-22T16:15:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dapperd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7c8e57/32.png) [@dapperd](https://www.ruby-forum.com/u/dapperd)\
**Post date:** [November 22, 2007, 4:15pm UTC](https://www.ruby-forum.com/t/getting-ruby-to-work-with-postgres-on-windows-xp/121005/1 "2007-11-22T16:15:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dapperd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7c8e57/32.png) [@dapperd](https://www.ruby-forum.com/u/dapperd)\
**Post date:** [November 22, 2007, 5:20pm UTC](https://www.ruby-forum.com/t/getting-ruby-to-work-with-postgres-on-windows-xp/121005/2 "2007-11-22T17:20:32Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![dapperd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7c8e57/32.png) [@dapperd](https://www.ruby-forum.com/u/dapperd)\
**Post date:** [November 22, 2007, 7:04pm UTC](https://www.ruby-forum.com/t/getting-ruby-to-work-with-postgres-on-windows-xp/121005/3 "2007-11-22T19:04:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dapperd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7c8e57/32.png) [@dapperd](https://www.ruby-forum.com/u/dapperd)\
**Post date:** [November 22, 2007, 9:38pm UTC](https://www.ruby-forum.com/t/getting-ruby-to-work-with-postgres-on-windows-xp/121005/4 "2007-11-22T21:38:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dapperd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7c8e57/32.png) [@dapperd](https://www.ruby-forum.com/u/dapperd)\
**Post date:** [November 23, 2007, 9:54am UTC](https://www.ruby-forum.com/t/getting-ruby-to-work-with-postgres-on-windows-xp/121005/5 "2007-11-23T09:54:59Z")

</div>

Thank you both. Works great with postgres-pr.

I can’t wait till I get off this Windows box 🙂

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

---

<div class="post-metadata">

**Author:** ![dapperd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/7c8e57/32.png) [@dapperd](https://www.ruby-forum.com/u/dapperd)\
**Post date:** [November 24, 2007, 2:13am UTC](https://www.ruby-forum.com/t/getting-ruby-to-work-with-postgres-on-windows-xp/121005/6 "2007-11-24T02:13:55Z")

</div>

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 🙂
> 
> 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
