Connect to the database

 avatar
unknown
python
2 years ago
227 B
4
Indexable
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")
Editor is loading...