Connect to the database

mail@pastecode.io avatarunknown
python
a month ago
227 B
0
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")