Connect to the database

mail@pastecode.io avatar
unknown
python
a year ago
227 B
1
Indexable
Never
def connect_db():
    try:
        con = psycopg2.connect(database="x", user="u1", password="p1", host="xxx.xxx.xxx", port="0")
        return con
    except:
        print("An error occurred trying to connect to the database")