Merge Hintergrund, Datenbank

This commit is contained in:
2022-01-10 14:22:36 +01:00
16 changed files with 51 additions and 3 deletions

View File

@@ -15,6 +15,8 @@ import javafx.stage.Stage;
public class HappyBirdMain extends Application {
MariaDB datenbank = new MariaDB();
/*Panes erstellen und zuweisen*/
private final Pane pane = new Pane();
private final Pane pause = new Pane();

View File

@@ -1,6 +1,5 @@
package com.example.happy_bird;
import java.beans.Statement;
import java.sql.*;
public class MariaDB
{
@@ -13,10 +12,36 @@ public class MariaDB
public MariaDB()
{
username="root";
pw="HappyBird1";
url="jdbc:mariadb://localhost:3306/happybird";
driver="org.mariadb.jdbc.Driver";
try {
con = DriverManager.getConnection("jdbc:mariadb://localhost:3306/DB?user=root&password=HappyBird1");
} catch (SQLException e) {
Class.forName(driver);
con=DriverManager.getConnection(url, username, pw);
st=con.createStatement();
System.out.println("Connection is successful");
} catch (Exception e) {
System.out.println("Fehler in der Verbindung");
e.printStackTrace();
}
/*
try
{
con = DriverManager.getConnection("jdbc:mariadb://localhost:3306/happybird?user=root&password=HappyBird1");
st= (Statement) con.createStatement();
driver="org.mariadb.jdbc.Driver";
System.out.println("Connection is successful");
}
catch (Exception e)
{
System.out.println("Fehler in der Verbindung");
e.printStackTrace();
}
*/
}
}