Forum: Ruby on Rails Unable to connect to postgres on Fedora Core 5

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
467a76da87d56dab5e6f51b4d2e19c66?d=identicon&s=25 Martin Tomes (Guest)
on 2006-04-20 12:48
(Received via mailing list)
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/
560c83ff6b6600e39315a1cf75b7c229?d=identicon&s=25 Tom Copeland (Guest)
on 2006-04-21 21:23
(Received via mailing list)
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/
This topic is locked and can not be replied to.