psycopg2 cannot connect even though pgadmin can

Viewed 26

I'm trying to connect to a Postgres database on AWS with psycorg. it's all pretty standard:

param = {
        'database': "******",
        'user': "***",
        'password': "***",
        'host': '*******.rds.amazonaws.com',
        'port': 5432
    }
    psycopg2.connect(
        **param
        )

I can connect on pgadmin, and on pycharm, but psycorg2 throws me the error

psycopg2.OperationalError: could not translate host name '****' nodename nor servname provided, or not known
1 Answers

Not really a solution but a work around, I'm able to connect by using the jdbc api instead.

Related