Re: Connect to a database over ssh tunnel fails
Igor Polishchuk <[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <C6E2C00C.14B83%[email protected]> |
Please disregard it. I¹ve found the problem. In my connection string for psycopg2 the password parameter was at the first position andit was an empty password ³password=² After I moved the password parameter to the last position, it works with the tunnel. On 9/25/09 5:53 PM, "Igor Polishchuk" <[email protected]> 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? > > Thank you. > > > _______________________________________________ > Psycopg mailing list > Psycopg-IAPFreCvJWPBWskQ1e/[email protected] > http://lists.initd.org/mailman/listinfo/psycopg _______________________________________________ Psycopg mailing list Psycopg-IAPFreCvJWPBWskQ1e/[email protected] http://lists.initd.org/mailman/listinfo/psycopg