Forum: Ruby on Rails Postgresql connection problems

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.
8de32e3843358dc17cd93c7ea106aeb7?d=identicon&s=25 Bealach-na Bo (Guest)
on 2006-03-23 11:14
(Received via mailing list)
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:in
`establish_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:in
`process'
        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:in
`require'
        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:in
`require'
        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!
B8d11b4c89cfc6e34d6c9fb121c9acac?d=identicon&s=25 Claus Guttesen (Guest)
on 2006-03-23 13:39
(Received via mailing list)
> 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
8de32e3843358dc17cd93c7ea106aeb7?d=identicon&s=25 Bealach-na Bo (Guest)
on 2006-03-23 19:19
(Received via mailing list)
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
954f0a02e8e79bd673029e2aac04729d?d=identicon&s=25 Neil Dugan (Guest)
on 2006-03-24 00:20
(Received via mailing list)
Claus Guttesen wrote:
>>  adapter: postgresql
>>  encoding: UTF8
>>  min_messages: warning
>
>
> regards
> Claus
>
Can you connect to the same database via psql?
32d1b70dcff9066a90976c0fb18acabe?d=identicon&s=25 Neil Dugan (Guest)
on 2006-03-24 00:21
(Received via mailing list)
Claus Guttesen wrote:
>>  adapter: postgresql
>>  encoding: UTF8
>>  min_messages: warning
>
>
> regards
> Claus
>
Can you connect to the same database via psql?
This topic is locked and can not be replied to.