content: package Database;
  
  import java.sql.Connection;
  import java.sql.DriverManager;
  import java.sql.SQLException;
  
  public class DatabaseConnection {
      private static final String URL = "jdbc:mysql://localhost:3306/tailor_management";
      private static final String USER = "root";
      private static final String PASSWORD = "ahtisham123";
  
      static {
          try {
              // Load the MySQL JDBC driver
              Class.forName("com.mysql.cj.jdbc.Driver");
          } catch (ClassNotFoundException e) {
              throw new RuntimeException("Failed to load MySQL JDBC driver", e);
          }
      }
  
      public static Connection getConnection() throws SQLException {
          // Return a new database connection
          return DriverManager.getConnection(URL, USER, PASSWORD);
      }
      public static void main(String[] args) {
          try (Connection connection = DatabaseConnection.getConnection()) {
              if (connection != null) {
                  System.out.println("Database connection successful!");
              }
          } catch (SQLException e) {
              e.printStackTrace();
          }
      }
  }
  