From 5e57dfa0222fbe0fd5dad1f36b01bc6b4fc4f91b Mon Sep 17 00:00:00 2001 From: pbs2h20apa Date: Mon, 20 Dec 2021 12:34:52 +0100 Subject: [PATCH] Erste Klasse Datenbankeinbindung --- Happy_Bird/src/main/java/MariaDB.java | 20 ++++++++++++++++++++ Happy_Bird/src/main/java/module-info.java | 1 + 2 files changed, 21 insertions(+) create mode 100644 Happy_Bird/src/main/java/MariaDB.java diff --git a/Happy_Bird/src/main/java/MariaDB.java b/Happy_Bird/src/main/java/MariaDB.java new file mode 100644 index 0000000..d5b75f1 --- /dev/null +++ b/Happy_Bird/src/main/java/MariaDB.java @@ -0,0 +1,20 @@ +import java.beans.Statement; +import java.sql.*; +public class MariaDB +{ + public String username; + public String pw; + public String url; + public String driver; + Connection con; + Statement st; + + public MariaDB() + { + try { + con = DriverManager.getConnection("jdbc:mariadb://localhost:3306/DB?user=root&password=HappyBird1"); + } catch (SQLException e) { + e.printStackTrace(); + } + } +} diff --git a/Happy_Bird/src/main/java/module-info.java b/Happy_Bird/src/main/java/module-info.java index ca73f7f..4bc785c 100644 --- a/Happy_Bird/src/main/java/module-info.java +++ b/Happy_Bird/src/main/java/module-info.java @@ -2,6 +2,7 @@ module com.example.happy_bird { requires javafx.controls; requires javafx.fxml; requires java.desktop; + requires java.sql; opens com.example.happy_bird to javafx.fxml;