Skip to content

Instantly share code, notes, and snippets.

@NielsMinssen
Created August 11, 2022 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NielsMinssen/2be9d3c9f82e81622e1e349cb9d9f4ff to your computer and use it in GitHub Desktop.
Save NielsMinssen/2be9d3c9f82e81622e1e349cb9d9f4ff to your computer and use it in GitHub Desktop.
import psycopg2
DB_NAME = "mabdd" #modifier
DB_USER = "Denis" #modifier
DB_PASS = "unmdpsécurisé" #modifier
DB_HOST = "le.server.de.denis.fr" #modifier
DB_PORT = "5432" #ne pas modifier, c'est le port PostgreSQL
try:
conn = psycopg2.connect(database=DB_NAME,
user=DB_USER,
password=DB_PASS,
host=DB_HOST,
port=DB_PORT)
print("Database connectée")
except:
print("Database non connectée")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment