Skip to Content
Menu
This question has been flagged
3 Replies
41721 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?

Avatar
Discard
Author Best Answer

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 ;)

Avatar
Discard
Best Answer

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 ;)

Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
Jul 24
3492
2
Jan 24
10134
7
Jan 24
45455
0
Mar 23
1038
5
Apr 24
45298