# Unable to connect to postgres on Fedora Core 5

**URL:** <https://www.ruby-forum.com/t/unable-to-connect-to-postgres-on-fedora-core-5/58303>\
**Category:** Rails\
**Created:** [April 20, 2006, 12:48pm UTC](https://www.ruby-forum.com/t/unable-to-connect-to-postgres-on-fedora-core-5/58303 "2006-04-20T12:48:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Martin\_Tomes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8e7dd6/32.png) [@Martin\_Tomes](https://www.ruby-forum.com/u/Martin_Tomes)\
**Post date:** [April 20, 2006, 12:48pm UTC](https://www.ruby-forum.com/t/unable-to-connect-to-postgres-on-fedora-core-5/58303/1 "2006-04-20T12:48:53Z")

</div>

I have been struggling for hours trying to connect Rails to postgresql.  
I have trawled google results - all to no avail! I have installed the  
postgres gem but it doesn’t appear to install properly:

# gem install postgres

Attempting local installation of ‘postgres’  
Local gem file not found: postgres\*.gem  
Attempting remote installation of ‘postgres’  
Building native extensions. This could take a while…  
ruby extconf.rb install postgres  
checking for cygwin32\_socket() in -lwsock32… no  
checking for socket() in -lsocket… no  
checking for gethostbyname() in -linet… no  
checking for gethostbyname() in -lnsl… yes  
checking for sys/un.h… yes  
checking for socket()… yes  
checking for hsterror()… no  
checking for gethostname()… yes  
checking for PQsetdbLogin() in -lpq… yes  
checking for PQsetClientEncoding()… yes  
checking for pg\_encoding\_to\_char()… yes  
checking for PQescapeString()… yes  
creating Makefile

make  
i386-redhat-linux-gcc -fPIC -I. -I/usr/lib/ruby/1.8/i386-linux  
-I/usr/lib/ruby/1.8/i386-linux -I. -DHAVE\_SYS\_UN\_H -DHAVE\_SOCKET  
-DHAVE\_GETHOSTNAME -DHAVE\_PQSETCLIENTENCODING -DHAVE\_PG\_ENCODING\_TO\_CHAR  
-DHAVE\_PQESCAPESTRING -c postgres.c  
i386-redhat-linux-gcc -shared -L"/usr/lib" -o postgres.so postgres.o  
-lruby -lpq -lnsl -ldl -lcrypt -lm -lc

make install  
make: Nothing to be done for `install’.  
Successfully installed postgres-0.7.1

If I require ‘postgres’ in irb it fails to load, I have also set up this  
in database.yml:

development:  
adapter: postgres  
database: railstest  
username: martinto  
password:  
host: localhost

If I then type:

script/generate migration initial

I get a long stack trace which has this at the start:

/usr/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:200:in  
`establish\_connection’: database configuration specifies nonexistent  
postgres adapter (ActiveRecord::AdapterNotFound)

What am I doing wrong?

–  
Martin Tomes  
echo ‘martin at tomes x org x uk’  
| sed -e ‘s/ x /./g’ -e ‘s/ at /@/’

Visit [http://www.subversionary.org/](http://www.subversionary.org/)

---

<div class="post-metadata">

**Author:** ![Martin\_Tomes](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/8e7dd6/32.png) [@Martin\_Tomes](https://www.ruby-forum.com/u/Martin_Tomes)\
**Post date:** [April 21, 2006, 9:23pm UTC](https://www.ruby-forum.com/t/unable-to-connect-to-postgres-on-fedora-core-5/58303/2 "2006-04-21T21:23:33Z")

</div>

On Thu, 2006-04-20 at 11:46 +0100, Martin Tomes wrote:

> I have been struggling for hours trying to connect Rails to postgresql.  
> I have trawled google results - all to no avail! I have installed the  
> postgres gem but it doesn’t appear to install properly:  
> I have also set up this  
> in database.yml:  
> development:  
> adapter: postgres

I think you want this:

# ==================================== development: adapter: postgresql

Yours,

Tom  
[http://tomcopeland.blogs.com/](http://tomcopeland.blogs.com/)
