# Ruby error with postgres

**URL:** <https://www.ruby-forum.com/t/ruby-error-with-postgres/109679>\
**Category:** Rails\
**Created:** [July 17, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/ruby-error-with-postgres/109679 "2007-07-17T20:40:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 17, 2007, 8:40pm UTC](https://www.ruby-forum.com/t/ruby-error-with-postgres/109679/1 "2007-07-17T20:40:13Z")

</div>

Im getting the following error while using postgres from ruby. Im new  
to ruby any help would be appreciated.

c:/ruby/lib/ruby/1.8/readbytes.rb:21:in `read': Invalid argument (Errno::EINVAL) from c:/ruby/lib/ruby/1.8/readbytes.rb:21:in`readbytes’  
from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/  
message.rb:32:in `read' from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/ connection.rb:30:in`initialize’  
from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/  
connection.rb:29:in `loop' from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/ connection.rb:29:in`initialize’  
from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/  
postgres-compat.rb:23:in `new' from c:/ruby/lib/ruby/gems/1.8/gems/postgres-pr-0.4.0/lib/postgres-pr/ postgres-compat.rb:23:in`initialize’  
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/  
active\_record/connection\_adapters/postgresql\_adapter.rb:24:in  
`connect' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/connection_adapters/postgresql_adapter.rb:24:in`postgresql\_connection’  
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/  
active\_record/connection\_adapters/abstract/connection\_specification.rb:  
262:in `send' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/connection_adapters/abstract/connection_specification.rb: 262:in`connection\_without\_query\_cache=’  
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/  
active\_record/query\_cache.rb:54:in `connection=' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/connection_adapters/abstract/connection_specification.rb: 230:in`retrieve\_connection’  
from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/  
active\_record/connection\_adapters/abstract/connection\_specification.rb:  
78:in `connection' from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/ active_record/base.rb:427:in`find\_by\_sql’

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 18, 2007, 10:25am UTC](https://www.ruby-forum.com/t/ruby-error-with-postgres/109679/2 "2007-07-18T10:25:59Z")

</div>

That’s because Rails can’t read from the connection. Try restarting  
postgresql.

On 7/17/07, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> connection.rb:30:in `initialize' `connect’  
> active\_record/query\_cache.rb:54:in `connection=’
> 
> >

–  
Dan S.  
www.peoplehub.com.au  
[www.dansketcher.com](http://www.dansketcher.com)
