Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Postgres Psycopg2 Unix Socket problemito

By
David Arnold
on 5/18/14, 4:00 PM 5,853 views

With Odoo-Trunk on a ubuntu precise64 box out of vagrant hashicorp/precise64 base box (on 18.05.2014 state)

  File "/usr/share/pyshared/openerp/sql_db.py", line 502, in borrow
    result = psycopg2.connect(dsn=dsn, connection_factory=PsycoConnection)
  File "/usr/share/pyshared/psycopg2/__init__.py", line 179, in connect
    connection_factory=connection_factory, async=async)
OperationalError: 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"?

 

the corresponding __init__.py states a few lines above the line 179 in question:

"""

[...]

The basic connection parameters are:

    - *dbname*: the database name (only in dsn string)
    - *database*: the database name (only as keyword argument)
    - *user*: user name used to authenticate
    - *password*: password used to authenticate
    - *host*: database host address (defaults to UNIX socket if not provided)
    - *port*: connection port number (defaults to 5432 if not provided)

    Using the *connection_factory* parameter a different class or connections
    factory can be specified. It should be a callable object taking a dsn
    argument.

    Using *async*=True an asynchronous connection will be created.

    Any other keyword parameter will be passed to the underlying client
    library: the list of supported parameter depends on the library version.

    """

I tried to set as postgres-user PGHOST to localhost as suggested here: http://stackoverflow.com/questions/13868730/socket-file-var-pgsql-socket-s-pgsql-5432-missing-in-mountain-lion-os-x-ser

restarted psotgres -> same issue

in /var/run/postgresql there is a 9.1-main.pid

How to solve?

1
Damodar D.
On 1/30/16, 9:53 PM

I tested the previous solution and it didn't worked for me, then I tried to login psql and got the same:

psql: 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"?

Then the problem was not psycopg2 but postgresql not running, then I tried to start it

sudo /etc/init.d/postgresql start

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = (unset),

LC_ALL = (unset),

LC_MONETARY = "es_CO.UTF-8",

 .......

are supported and installed on your system.

perl: warning: Falling back to a fallback locale ("en_US.UTF-8").

The problem was locale not loaded correctly, I fixed it with:

sudo locale-gen "en_US.UTF-8"
sudo locale-gen "es_CO.UTF-8"

sudo dpkg-reconfigure locales

sudo service postgresql restart

sudo service odoo restart

It worked ;)

0
betton
On 6/21/16, 5:23 PM

I have actually the sam with odoo community 9.0

File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 164, in connect
    conn = _connect(dsn, connection_factory=connection_factory, async=async)
OperationalError: could not connect to server: Aucun fichier ou dossier de ce type
	Is the server running locally and accepting
	connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


I change my openerp-server.conf as you say but the issue still the same

0
David Arnold
On 5/18/14, 6:24 PM

This is the answer: http://stackoverflow.com/questions/5500332/cant-connect-the-postgresql-with-psycopg2

 

wich solves to editing the openerp-server.conf

[options]
; This is the password that allows database operations:
; admin_passwd = admin
db_host = "/tmp/.s.PGSQL.5432"
db_port = False
db_user = openerp
db_password = False

 

It worked ;)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/18/14, 4:00 PM
Seen: 5853 times
Last updated: 6/21/16, 5:23 PM