trying to connect to a Postgres database inside docker but having the following problem:
File "", line 1, in pyodbc.OperationalError: ('08001', '[08001] could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket "/tmp/.s.PGSQL.5432"?\n (101) (SQLDriverConnect)')
The connection is being established with the following:
conn_str = ("DRIVER=/usr/local/lib/psqlodbcw.so;""DATABASE=mytestdb;""UID=postgres;""PWD=mysecretpassword""SERVER=localhost;""PORT=5432;");
conn = pyodbc.connect(conn_str)
SERVER=localhost), you might want to see the ip of your docker instance, otherwise setup a NAT for the docker..