# Postgresql connection problems

**URL:** <https://www.ruby-forum.com/t/postgresql-connection-problems/55734>\
**Category:** Rails\
**Created:** [March 23, 2006, 11:14am UTC](https://www.ruby-forum.com/t/postgresql-connection-problems/55734 "2006-03-23T11:14:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bealach-na\_Bo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e274bd/32.png) [@Bealach-na\_Bo](https://www.ruby-forum.com/u/Bealach-na_Bo)\
**Post date:** [March 23, 2006, 11:14am UTC](https://www.ruby-forum.com/t/postgresql-connection-problems/55734/1 "2006-03-23T11:14:41Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Bealach-na\_Bo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e274bd/32.png) [@Bealach-na\_Bo](https://www.ruby-forum.com/u/Bealach-na_Bo)\
**Post date:** [March 23, 2006, 1:39pm UTC](https://www.ruby-forum.com/t/postgresql-connection-problems/55734/2 "2006-03-23T13:39:18Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Bealach-na\_Bo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e274bd/32.png) [@Bealach-na\_Bo](https://www.ruby-forum.com/u/Bealach-na_Bo)\
**Post date:** [March 24, 2006, 12:20am UTC](https://www.ruby-forum.com/t/postgresql-connection-problems/55734/3 "2006-03-24T00:20:44Z")

</div>

Claus G. wrote:

> > adapter: postgresql  
> > encoding: UTF8  
> > min\_messages: warning
> 
> regards  
> Claus

Can you connect to the same database via psql?

---

<div class="post-metadata">

**Author:** ![Bealach-na\_Bo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e274bd/32.png) [@Bealach-na\_Bo](https://www.ruby-forum.com/u/Bealach-na_Bo)\
**Post date:** [March 24, 2006, 12:21am UTC](https://www.ruby-forum.com/t/postgresql-connection-problems/55734/4 "2006-03-24T00:21:22Z")

</div>

Claus G. wrote:

> > adapter: postgresql  
> > encoding: UTF8  
> > min\_messages: warning
> 
> regards  
> Claus

Can you connect to the same database via psql?

---

<div class="post-metadata">

**Author:** ![Bealach-na\_Bo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e274bd/32.png) [@Bealach-na\_Bo](https://www.ruby-forum.com/u/Bealach-na_Bo)\
**Post date:** [March 23, 2006, 7:19pm UTC](https://www.ruby-forum.com/t/postgresql-connection-problems/55734/5 "2006-03-23T19:19:45Z")

</div>

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
