Class DBConnection

java.lang.Object
lukas.wais.smart.mirror.model.DBConnection

public class DBConnection
extends java.lang.Object
The Class DBConnection.
  • Constructor Summary

    Constructors 
    Constructor Description
    DBConnection()
    Constructor for the DBConnection.
  • Method Summary

    Modifier and Type Method Description
    java.sql.Connection getConnection()
    Getter method for the private variable connection.
    static DBConnection getInstance()
    Gets the single instance of DBConnection.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DBConnection

      public DBConnection() throws java.sql.SQLException
      Constructor for the DBConnection. Creation a connection to the H2 database
      Throws:
      java.sql.SQLException - the SQL exception for connection issues to database
  • Method Details

    • getConnection

      public java.sql.Connection getConnection()
      Getter method for the private variable connection. The connection to the database will be stored here.
      Returns:
      the connection to the database
    • getInstance

      public static DBConnection getInstance()
      Gets the single instance of DBConnection. With this method we implement the Singleton Pattern in oder to avoid multiple access/instance to the database
      Returns:
      single instance of DBConnection