Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I've got a VPN to my server network set up. Everything works fine, I can ping servers and ssh around the network. Except for the database connection.

When I use PgAdmin on ubuntu and insert connection details (ip,host etc.) it connects without problems. But when I try the same with Python psycopg2/PyGreSql I either get a can't resolve hostname error (name or service not known) or no hba.conf rule error. I added the rule and it didn't change anything.

I reckon that if the rule didn't work PgAdmin wouldn't connect.

PgSql ver: 8.3.7 on Debian 4.3.2 Pgadmin3 ver - newest for ubuntu (1.18.1) psycopg2/PyGreSql - newest versions from pip.

While I'm not sure about psycopg2, PyGreSql should support my old database version, so that shouldn't be the problem.

share|improve this question
    
I reckon you should show the exact error message text :p . Separately, 8.3.7, really? Any reason you're relying on a fossil database? –  Craig Ringer Sep 5 '14 at 11:03
    
Yep there is a reason. The whole server room and the software is fossil and I have no means of updating it. This place is hell I tell you. Problem fixed by restarting the DB - I guess the hbconf rule didn't apply for some reason. Wonder why PgAdmin was still able to connect from the same PC? –  Marcin Janeczek Sep 5 '14 at 12:08
    
Per the documenation, pg_hba.conf changes only take effect when you reload the server - either restarting it, using SELECT pg_reload_conf(), or sending a SIGHUP to the postmaster (possibly via pg_ctl reload). I expect your PgAdmin connection worked because you were connection with different options - different database name, username, source host address, ssl mode, etc. –  Craig Ringer Sep 5 '14 at 12:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.