# Cannot Connect to PostgresSQL DB

**URL:** https://discuss.tryton.org/t/cannot-connect-to-postgressql-db/574
**Category:** User
**Created:** [May 30, 2018, 1:09pm UTC](https://discuss.tryton.org/t/cannot-connect-to-postgressql-db/574 "2018-05-30T13:09:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![why2](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/w/c67d28/32.png) [@why2](https://discuss.tryton.org/u/why2)
#### Post date: [May 30, 2018, 1:09pm UTC](https://discuss.tryton.org/t/cannot-connect-to-postgressql-db/574/1 "2018-05-30T13:09:53Z")

</div>

Hi,

After starting the daemon `trytond` and the client `tryton` and then filling the form to connect to the DB, I get an Application Error BadStatusLine:

```auto
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/tryton/gui/window/dblogin.py", line 599, in run
    if not common.test_server_version(host, port):
  File "/usr/lib/python2.7/dist-packages/tryton/common/common.py", line 231, in test_server_version
    version = rpc.server_version(host, port)
  File "/usr/lib/python2.7/dist-packages/tryton/rpc.py", line 67, in server_version
    result = connection.common.server.version(None, None)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.7/dist-packages/tryton/jsonrpc.py", line 283, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python2.7/xmlrpclib.py", line 1313, in single_request
    response = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/httplib.py", line 1136, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 453, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 417, in _read_status
    raise BadStatusLine(line)
BadStatusLine: ''

```

Any hint?

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [May 30, 2018, 1:28pm UTC](https://discuss.tryton.org/t/cannot-connect-to-postgressql-db/574/2 "2018-05-30T13:28:12Z")

</div>

It seems an issue with the server. You should check your server logs not the client ones.

If you paste them here we can give a better advice.

---

<div class="post-metadata">

### Author: ![why2](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/w/c67d28/32.png) [@why2](https://discuss.tryton.org/u/why2)
#### Post date: [May 30, 2018, 1:58pm UTC](https://discuss.tryton.org/t/cannot-connect-to-postgressql-db/574/3 "2018-05-30T13:58:06Z")

</div>

Hi @pokoli, I cannot see any logs from my Linux console, even with `-v` there is no logs on the server console.  
From the postgresql logs in `/var/log/postgresql/postgresql-9.5-main.log`, I can see:

```auto
[unknown]@[unknown] LOG: invalid length of startup packet

```

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [May 30, 2018, 2:55pm UTC](https://discuss.tryton.org/t/cannot-connect-to-postgressql-db/574/4 "2018-05-30T14:55:09Z")

</div>

> [@why2](#):
>
> Hi @pokoli, I cannot see any logs from my Linux console, even with `-v` there is no logs on the server console.

You should start the server with the --verbose option to see the logs on the standard output of the running terminal.

Aditionaly you can use a more advanced logging configuration as [explained on the logging section](http://doc.tryton.org/4.8/trytond/doc/topics/logs.html#topics-logs)

---

<div class="post-metadata">

### Author: ![why2](https://discuss-cdn.tryton.org/letter_avatar_proxy/v4/letter/w/c67d28/32.png) [@why2](https://discuss.tryton.org/u/why2)
#### Post date: [May 30, 2018, 3:05pm UTC](https://discuss.tryton.org/t/cannot-connect-to-postgressql-db/574/5 "2018-05-30T15:05:03Z")

</div>

```auto
venvs/ytryton-Lrmto7Kr/local/lib/python2.7/site-packages/psycopg2/ __init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
OperationalError: FATAL: Peer authentication failed for user "tryton_admin"

```

Somehow, I cannot give a correct password to my Postgresql, even I only know one password and created a new user and database twice.
