Package lukas.wais.smart.mirror.model
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.
-
Constructor Details
-
DBConnection
public DBConnection() throws java.sql.SQLExceptionConstructor 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
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
-