I am trying to connect to postgres database from RoR. I have username and password in database.yml, but when trying to connect, I get the following error: No such file or directory - /tmp/.s.PGSQL.5432 Why is it? I would also prefer to connect by TCP connection instead of UNIX socket, how can I configure this? Thanks in advance Paweł Stawicki -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 22 Nov., 10:05, Pawel Stawicki <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I am trying to connect to postgres database from RoR. I have username > and password in database.yml, but when trying to connect, I get the > following error: > > No such file or directory - /tmp/.s.PGSQL.5432 > > Why is it? I would also prefer to connect by TCP connection instead of > UNIX socket, how can I configure this?I remember having the same problem, but I don''t remember the details anymore. Anyway, here''s my current database.yml: production: adapter: postgresql database: foo_production username: postgres password: secret host: localhost encoding: UTF8 Similar for test and development, _no_ other settings. (Especially, I think there was a "port" setting that needed to be removed.) HTH, Stefan --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pawel Stawicki wrote:> I am trying to connect to postgres database from RoR. I have username > and password in database.yml, but when trying to connect, I get the > following error: > > No such file or directory - /tmp/.s.PGSQL.5432 > > Why is it? I would also prefer to connect by TCP connection instead of > UNIX socket, how can I configure this? >Check under ''connections and authentication'' in data/postgresql.conf to see if you''re listening on the connect ip-adresses (or listening on ip at all). You might also need to adapt data/pg_hba.conf to enable local access with the account you''re using. My database.yml looks like the one Stefan Lang posted. Piet. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> Check under ''connections and authentication'' in data/postgresql.conf to > see if you''re listening on the connect ip-adresses (or listening on ip > at all).I am. I can connect by phpphadmin (web php tool) with user and password without problems. But it seems to me that ruby tries to connect by socket, not by TCP/IP, and I don''t like this. Regards Pawel Stawicki -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry, didn''t notice the first answer. I will try removing "port". Regards Paweł Stawicki -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok, it worked, but now I got next error. I have table "Article", and I created model Article, but when I try to run test (just to test connection), I get "Exception: RuntimeError: ERROR C42P01 Mrelation "article" does not exist Fnamespace.c L221 RRangeVarGetRelid: DELETE FROM article" My table has name beginning with capital letter, but I think I doesn''t matter, because when I had changed it, I still was getting the error. Regards Paweł Stawicki -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Pawel Stawicki wrote:> My table has name beginning with capital letter, but I think I doesn''t > matter, because when I had changed it, I still was getting the error.I know the parent post is from a long time ago, but it turns out that this is a bug in the rails postgresql adapter -- it doesn''t support table names with capital letters. There''s a ticket and patch here: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2418 If anyone could verify this patch, it would be much appreciated. Thanks, Scott -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---