2022-03-17 13:07:35 +01:00
|
|
|
# TODO Database verbindung herstellen
|
2022-03-17 13:22:44 +01:00
|
|
|
|
|
|
|
import mysql.connector
|
|
|
|
|
2022-03-17 13:36:16 +01:00
|
|
|
|
2022-03-17 13:22:44 +01:00
|
|
|
def db_connection(user, password, host):
|
2022-03-17 13:36:16 +01:00
|
|
|
connection = ''
|
2022-03-17 13:22:44 +01:00
|
|
|
|
|
|
|
try:
|
2022-03-17 13:36:16 +01:00
|
|
|
connection = mysql.connector.connect(user=user, password=password, host=host)
|
2022-03-17 13:22:44 +01:00
|
|
|
except mysql.connector.Error as err:
|
2022-03-17 13:36:16 +01:00
|
|
|
print('Something went wrong', err)
|
2022-03-17 13:22:44 +01:00
|
|
|
return connection.cursor()
|