#144 ✓resolved
pupeno@pupeno.com

Can't connect to PostgreSQL without password

Reported by pupeno@pupeno.com | February 1st, 2008 @ 07:27 PM

It is not possibel to connect to a PostgreSQL database without suppling a password. Postgres supports various kinds of authentication, among them, ident, which doesn't need any password, authenticates using the local login. The follow program fails while it should succed:

require 'rubygems'
require 'data_mapper'

d = DataMapper::Database.setup({:adapter => 'postgresql', :host => 'localhost', :username => 'pupeno', :database => 'pupeno'})

class Post < DataMapper::Base
property :title, :string property :body, :text property :created_at, :datetime end

database.save(Post)

It fails with this errors:

/opt/ruby//lib/ruby/gems/1.8/gems/do_postgres-0.2.3/lib/do_postgres.rb:21:in open': Unable to connect to database with provided connection string. (DataObject::ConnectionFailed) fe_sendauth: no password supplied from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/adapters/postgresql_adapter.rb:42:increate_connection' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/adapters/data_object_adapter.rb:52:in initialize' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/support/connection_pool.rb:103:incall' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/support/connection_pool.rb:103:in make_new' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/support/connection_pool.rb:95:inavailable' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/support/connection_pool.rb:86:in acquire' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/support/connection_pool.rb:85:insynchronize' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/support/connection_pool.rb:85:in acquire' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/support/connection_pool.rb:64:inhold' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/adapters/data_object_adapter.rb:77:in connection' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/adapters/sql/mappings/table.rb:90:inexists?' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/adapters/sql/mappings/table.rb:112:in create!' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/adapters/data_object_adapter.rb:198:insave' from /opt/ruby//lib/ruby/gems/1.8/gems/datamapper-0.2.5/lib/data_mapper/context.rb:60:in `save' from ./test.rb:14

Thanks.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages