Re: Connect to a database over ssh tunnel fails

Tim Roberts <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization Providenza & Boekelheide, Inc.
Message-ID <[email protected]>
Igor Polishchuk wrote:
>    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?

Show us the line you used to connect.

-- 
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.

_______________________________________________
Psycopg mailing list
[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.