Forum: Ruby on Rails 2.0.2 Postgres don't work

F463acaf740680f961983cfa1a651da2?d=identicon&s=25 Carlos ag (winkel)
on 2008-01-02 21:54
Hi,
 I got absutly no connection on Ubuntu LTS 6.06 AMD 64.

starting mongrel_rails I got the error:

---
snip
---
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:231:in
`establish_connection': Please install the postgres adapter: `gem
install activerecord-postgres-adapter` (no such file to load --
active_record/connection_adapters/postgres_adapter)

---
snap
---

Installed deb's (db-related)

- libdbi-ruby1.8
- libpgsql-ruby1.8
- ruby1.8-dev

gems:

- postgres (0.7.9.2007.12.22)


Have anybody an idee?

PostgreSQL and rails 1.2.5 on an other Ubuntu LTS 6.06 machine worked
very well.

require 'postgres' in irb is running.

Thanks in advance

Winkel
2f9a03aa0fcfe945229cb6126eda2cb2?d=identicon&s=25 Philip Hallstrom (Guest)
on 2008-01-02 22:14
(Received via mailing list)
> `establish_connection': Please install the postgres adapter: `gem
> install activerecord-postgres-adapter` (no such file to load --
> active_record/connection_adapters/postgres_adapter)

Did you do this?

gem install activerecord-postgres-adapter

?
F463acaf740680f961983cfa1a651da2?d=identicon&s=25 Carlos ag (winkel)
on 2008-01-02 22:17
> Did you do this?
>
> gem install activerecord-postgres-adapter
>
> ?
Yes indeed but it looks like as 'activerecord-postgres-adapter' is not a
gem.

I got the  error:

--
ERROR:  could not find activerecord-postgres-adapter locally or in a
repository
--

Thanks

Winkel
9a2a53db8e9b4476038c94a64b32833f?d=identicon&s=25 Ryan Bigg (Guest)
on 2008-01-03 00:03
(Received via mailing list)
does script/plugin install activerecord-postgres-adapter work?

I looked on the svn.rubyonrails.org site and I couldn't see the postgres
adapter there. I tried installing it myself and I couldn't find it
either.


On Jan 3, 2008 7:47 AM, Carlos Grießmayer
<rails-mailing-list@andreas-s.net>
wrote:

> I got the  error:
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


--
Ryan Bigg
http://www.frozenplague.net
Feel free to add me to MSN and/or GTalk as this email.
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2008-01-03 00:12
(Received via mailing list)
On Jan 2, 2008 3:54 PM, Carlos Grießmayer
<rails-mailing-list@andreas-s.net> wrote:
> `establish_connection': Please install the postgres adapter: `gem
> install activerecord-postgres-adapter` (no such file to load --
> active_record/connection_adapters/postgres_adapter)

Do you have postgres or postgresql as the adapter name in your
database.yml file?

The postgresql adapter (which is the proper name) is one of the
remaining standard adapters stlll included with ActiveRecord-2.0.x

There is no gem.

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
6b4944d281602b93e09839bf22adffd8?d=identicon&s=25 fredistic (Guest)
on 2008-01-03 13:42
(Received via mailing list)
All I can think of is to ask Robby Russell, he usually keeps track of
issues in Rails vs Postgresql:

http://www.robbyonrails.com/

f
6b4944d281602b93e09839bf22adffd8?d=identicon&s=25 fredistic (Guest)
on 2008-01-03 13:58
(Received via mailing list)
I set up my current project under Rails 1.x and haven't changed the
database.yml for rails 2.0.2. Here's an excerpt.  It still works.  I
guess the older gems mentioned in the comments should still work, if
you want to try them.

I'm using postgresql 8.2.5 on winxp.  And another version on Linux.

# PostgreSQL versions 7.4 - 8.1
#
# Get the C bindings:
#   gem install postgres
# or use the pure-Ruby bindings on Windows:
#   gem install postgres-pr
development:
  adapter: postgresql
  database: project_development
  username: project
  password: whatever
  encoding: UTF8
8f6f95c4bd64d5f10dfddfdcd03c19d6?d=identicon&s=25 Rick Denatale (rdenatale)
on 2008-01-03 15:14
(Received via mailing list)
On Jan 3, 2008 7:57 AM, fredistic <fredistic@gmail.com> wrote:
> # Get the C bindings:
> #   gem install postgres
> # or use the pure-Ruby bindings on Windows:
> #   gem install postgres-pr
> development:
>   adapter: postgresql
>   database: project_development
>   username: project
>   password: whatever
>   encoding: UTF8

I'm assuming that this was in response to my query about what the OP
had in his database.yml.

To be clear about what I was suggesting:

Here's his error:
usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/connection_specification.rb:231:in
`establish_connection': Please install the postgres adapter: `gem
install activerecord-postgres-adapter` (no such file to load --
active_record/connection_adapters/postgres_adapter)

Note that it's asking for the postgres_adapter NOT the
postgreslq_adapter.  The postgres in that name is coming from the
adapter specificed in database.yml.

The way ActiveRecord::Base works is like this.

  1) It ensures that an adapter WAS in fact specified in the
configuration (i.e. database.yml)
  2) It sets up the gem environment
  3) It then does this:

            begin
              require
"active_record/connection_adapters/#{spec[:adapter]}_adapter"
            rescue LoadError
              raise "Please install the #{spec[:adapter]} adapter:
`gem install activerecord-#{spec[:adapter]}-adapter` (#{$!})"
            end

The gems are actually a fall back if the adapter isn't a standard part
of active-record.  here are the relevant 'built-in' database adapters:

   activerecord/connection_adapters/mysql_adapter.rb
   activerecord/connection_adapters/postgresql_adapter.rb
   activerecord/connection_adapters/sqlite3_adapter.rb
   activerecord/connection_adapters/sqlite_adapter.rb

So as I see it, I suspect that the OP has

   adapter:  postgres

instead of

  adapter: postgresql

in his configuration

So it's looking for a gem which has the fictitious postgres_adapter.
Note that these adapter gems are ActiveRecord connection adapters, not
database gems which might be required for ruby support of the database
in question.

--
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/
8388931f2ff534bf091173c0f7077eca?d=identicon&s=25 Fuat Geleri (phoad)
on 2009-10-10 19:23
Do you have more than one gems directory.
I had a similar problem and solved it via setting the GEN_HOME variable
to the personal gems install directory.

The problem..
[~/rails/helloblog]# ./script/generate
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:76:in
`establish_connection': Please install the postgresql adapter: `gem
install activerecord-postgresql-.......

The solution i found on net
[~/rails/helloblog]# export GEM_HOME=/home/phoad/ruby/gems
[~/rails/helloblog]# export PATH=/home/phoad/ruby/bin:$PATH

Viola..
[~/rails/helloblog]# ./script/generate scaffold Blog id:int title:string
      exists  app/models/
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/blogs
      exists  app/views/layouts/
      exists  test/functional/

Good luck..
8388931f2ff534bf091173c0f7077eca?d=identicon&s=25 Fuat Geleri (phoad)
on 2009-10-10 19:38
Moreover you may need to add --prefix parameter to your commands, like
this.

[~/rails/helloblog]# rake db:migrate --prefix=$GEM_HOME
Dd2d775dea75b381edb1bbf0600a0907?d=identicon&s=25 Marnen Laibow-Koser (marnen)
on 2009-10-10 20:19
Philip Hallstrom wrote:
>> `establish_connection': Please install the postgres adapter: `gem
>> install activerecord-postgres-adapter` (no such file to load --
>> active_record/connection_adapters/postgres_adapter)
>
> Did you do this?
>
> gem install activerecord-postgres-adapter
>
> ?

The error message is misleading; there is no such gem.  You'll have to
install or update the postgres or pg gem.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
5022b0eaa66a88357822eaad9d087621?d=identicon&s=25 Prasad B. (durga_b)
on 2011-03-09 06:48
i am also same problem please give me solution . I am getting below
error
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:76:in
`establish_connection': Pl
ease install the postgres adapter: `gem install
activerecord-postgres-adapter` (
no such file to load --
active_record/connection_adapters/postgres_adapter) (Run
timeError)

i am using
----------
ruby 1.8.7
rails 2.3.5
pg 0.9.0
5022b0eaa66a88357822eaad9d087621?d=identicon&s=25 Prasad B. (durga_b)
on 2011-03-09 07:25
i am also same problem please give me solution . I am getting below
error
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:76:in
`establish_connection': Pl
ease install the postgresql adapter: `gem install
activerecord-postgresql-adapte
r` (no such file to load -- 1.8/pg_ext) (RuntimeError)

i am using
----------
ruby 1.8.7
rails 2.3.5
pg 0.9.0


in database.yml file:
----------------------
development:
  adapter: postgresql
  host: localhost
  username: postgres
  password: root
  database: oilwell7_development
  pool: 15
  encoding: utf8
  template: template0


But i have postgres_adapter.rb file


C:\Ruby187\lib\ruby\gems\1.8\gems\activerecord-2.3.5\lib\active_record\connection_adapters
but it says no such file to load .let me answer any one.

Thansk in advance
A2593cc2f4a68d523ccde1d17fb09766?d=identicon&s=25 Peter (Guest)
on 2011-03-09 22:04
(Received via mailing list)
On Mar 9, 12:25am, "Prasad B." <li...@ruby-forum.com> wrote:
>
> i am using
> ----------
> ruby 1.8.7
> rails 2.3.5
> pg 0.9.0
>


What's your full list of gems installed?  Back when I had problems
like these it was because I had both the pg and another of the
postgres drivers installed, although I can't remember which exact one
right now.

\Peter
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.