package Hotel.database;

import Hotel.database.tables.Booking;

import java.sql.*;

public class Connection {
    private final java.sql.Connection connection;
    private static Table customer;
    private static Table booking;
    private static Table room;

    public Connection() throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.jdbc.Driver");  // Load JDBC driver

        this.connection = DriverManager.getConnection(
                "jdbc:mysql://localhost:3306/Hotel", "root", "fastralee"
        );

        Connection.booking = new Booking(this.connection);
        Connection.booking.setup();
    }
}

@@ -494,21 +494,16 @@
 st:3306/
-Hotel
 %22, %22root
@@ -529,16 +529,188 @@
     );%0A%0A
+        Statement statement = this.connection.createStatement();%0A        statement.execute(%22CREATE DATABASE IF NOT EXISTS hotel%22);%0A        statement.execute(%22USE hotel%22);%0A%0A
         

Create database if it doesn't exist