Class Database

java.lang.Object
edu.ntnu.idatt1002.k1g4.dao.Database

public class Database extends Object
Class used to create Database connection
Version:
0.1
Author:
Callum Gran
  • Constructor Details

    • Database

      public Database()
  • Method Details

    • instance

      public static Database instance()
      Checks if there is an existing instance of Database. If not, it creates one.
      Returns:
      database Database: An instance of Database, either the existing one, or a newly created one.
    • getConnection

      public Connection getConnection() throws SQLException
      Method to get a connection from the Database object.
      Returns:
      Connection: A connection to the Database object.
      Throws:
      SQLException - if failing to get connection