Connect to a database over ssh tunnel fails

Igor Polishchuk <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <C6E2B41D.14B7F%[email protected]>
    I¹ve set up an ssh tunnel from my local host to a db host in a different
network. This db host¹s pg_hba does not allow to connect from my network
directly, so I though I could use the tunnel.
This tunnel allows me connect to the db with psql without a problem.
However, when I try to connect from a python/psycog2 script it fails.
Apparently, psycopg does not try to use the tunnel and checks the local Unix
socket file for the port I provide. Of course, nothing is listening there.
I set up the tunnel:
ssh -L 3335:localhost:5432  username@db_host

Psql ­p 3335  -- works well

Psycopg gives me an error message: ³No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.3335"?²

I¹m using python 2.5.1, psycopg2: 2.0.12

Am I missing something here? Does anybody use psycopg2 with an ssh tunnel?

Thank you.

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.