Re: rails with postgresql

Rajinder Yadav
2010-12-08T01:17:14Z

On 10-12-07 05:31 PM, David Kahn wrote:
>
>
> On Tue, Dec 7, 2010 at 4:25 PM, Rajinder Yadav <devguy.ca
> <http://devguy.ca>@gmail.com <http://gmail.com>> wrote:
>
>     On Tue, Dec 7, 2010 at 4:59 PM, David Kahn
>     <dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org
<mailto:dk-rfEMNHKVqOwNic7Bib+Ti1W1rNmOCjRP@public.gmane.org>> wrote:
>      >
>      >
>      > On Tue, Dec 7, 2010 at 3:49 PM, Rajinder Yadav <devguy.ca
>     <http://devguy.ca>@gmail.com <http://gmail.com>> wrote:
>      >>
>      >> Hi this is my first time for a few things. I am trying to get
rails
>      >> working with postgres-9.0.1, I have never used postgres
before. I do
>      >> know the server is listening on localhost:5432 as I am able
to
>     connect
>      >> to it using pgadmin3 and see the 2 databases on it.
>      >>
>      >> I have ''pg'' gem installed
>      >> my database.yml looks like this
>      >>
>      >> development:
>      >>  adapter: postgresql
>      >>  encoding: unicode
>      >>  database: test
>      >>  pool: 5
>      >>  username:
>      >>  password:
>      >>
>      >> however i am getting the following migrate error
>      >>
>      >> yadav@expression:$ rake db:migrate --trace
>      >> (in /home/yadav/dev/rails/tmp/testapp)
>      >> ** Invoke db:migrate (first_time)
>      >> ** Invoke environment (first_time)
>      >> ** Execute environment
>      >> ** Execute db:migrate
>      >> rake aborted!
>      >> could not connect to server: No such file or directory
>      >>        Is the server running locally and accepting
>      >>        connections on Unix domain socket
>     "/var/run/postgresql/.s.PGSQL.
>      >> 5432"?
>      >
>      > It might help if you can post your database.yml.... also, have
>     you created
>      > your databases (rake db:create:all)?
>      >
>
>     Hi David,
>
>     thanks for the tip, I got it working, just had to add "host:
>     localhost" as Philip pointed out.
>
>
> Cool... hey if you have a chance let me know if you can connect to the
> db using: "rails dbconsole".... I have never been successful
doing this
> and I just go to the postgresql command line but would be curious if it
> works for you.... I can connect no problem to the rails console, but for
> whatever reason I get "Couldn''t find database client: psql.
Check your
> $PATH and try again." when I try rails dbconsole.

Hi David,

''rails dbconsole'' works for me. Are you on Linux? if so what
do you get
when you do a ''which psql'', do you get the right path?

I built postgresql-9.0.1 from source, and the make install script puts
psql under /usr/local/pgsql/bin/psql

What I ended up doing instead of adding to the $PATH, was creating a
symbolic link under /usr/local/bin

lrwxrwxrwx 1 root root       25 2010-12-07 19:50 psql ->
/usr/local/pgsql/bin/psql

I am guessing, either you need to update your $PATH variable or use a
sym-link like me and things should work fine.


--
Kind Regards,
Rajinder Yadav | DevMentor.org | Do Good! ~ Share Freely

GNU/Linux: 2.6.35-22-generic
Kubuntu x86_64 10.10 | KDE 4.5.1
Ruby 1.9.2p0 | Rails 3.0.1