Postgresql connection problems


#1

Forgive me for asking a trivial question on this list, but being new
to Ruby/Ruby on Rails, I’m not sure where to start…

I’m trying to connect to a postgresql server:

My database.yml contains:

test_test:
adapter: postgresql
database: test_test
username: testuser
password: resutest
host: testpgserver
port: 5432
encoding: UTF8
min_messages: warning

The database is setup and talking with Java and Perl from the same
client as I’m trying to use Ruby on Rails on.

The command

ruby script/generate scaffold Product Admin

produces

--------------error--------------
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:73:in
establish_connection': development database is not configured (ActiveRecord::AdapterNotSpecified) from /usr/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:66:inestablish_connection’
from
/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:169:in
initialize_database' from /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:83:inprocess’
from
/usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/initializer.rb:42:in run' from ./script/../config/../config/environment.rb:10 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
require' from /usr/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/commands/generate.rb:1 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
from
/usr/lib/ruby/gems/1.8/gems/activesupport-1.2.5/lib/active_support/dependencies.rb:214:in
`require’
from script/generate:3
--------------error--------------

running interactively using irb I have no problems connecting and
talking to the db.

irb(main):018:0> require “postgres”
=> true
conn=PGconn.connect(“testpgserver”,5432,"","",“test_test”,“testuser”,“resutest”)
=> #PGconn:0x2aaaab567ae8

Please help!


#2

I’m trying to connect to a postgresql server:

My database.yml contains:

test_test:

Replace test_test with either development, test or production.

adapter: postgresql
database: test_test
username: testuser
password: resutest
host: testpgserver
port: 5432

If you use default this one is not needed.

encoding: UTF8
min_messages: warning

regards
Claus


#3

Claus G. wrote:

adapter: postgresql
encoding: UTF8
min_messages: warning

regards
Claus

Can you connect to the same database via psql?


#4

Claus G. wrote:

adapter: postgresql
encoding: UTF8
min_messages: warning

regards
Claus

Can you connect to the same database via psql?


#5

Thanks very much Claus,

I discovered my error soon after I sent the “help me” email, but am
grateful
for your quick response anyway.

Thanks again,

Bealach