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-18 12:30:09 +01:00
|
|
|
# Aufbau der verbindung zum Mysql Server
|
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-18 12:30:09 +01:00
|
|
|
# Verbindung mit die in der Config festgelegt werden
|
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-18 13:07:12 +01:00
|
|
|
print('Veruche deinen Mysql Server neu zu starten')
|
2022-03-17 13:22:44 +01:00
|
|
|
return connection.cursor()
|