java.lang.Object
com.prog3.ipt.Model.FacadeClasses.DatabaseConnectionSingleton
DatabaseConnectionSingleton interfaces with a MySQL Database Schema for IPT system, applying the Singleton design pattern
-
Field Summary
Modifier and TypeFieldDescriptionprivate Connection
private static DatabaseConnectionSingleton
private final String
private final String
private final String
-
Constructor Summary
ModifierConstructorDescriptionprivate
DatabaseConnectionSingleton constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic DatabaseConnectionSingleton
Returns the DatabaseConnectionSingleton instance The instance doesn't get created until the method is called for the first time.
-
Field Details
-
instance
-
connection
-
url
- See Also:
-
username
- See Also:
-
password
- See Also:
-
-
Constructor Details
-
DatabaseConnectionSingleton
private DatabaseConnectionSingleton()DatabaseConnectionSingleton constructor. Set up a connection passing url, username, password to DriverManager's getConnection method Protect against instantiation via reflection
-
-
Method Details
-
getConnection
-
getInstance
Returns the DatabaseConnectionSingleton instance The instance doesn't get created until the method is called for the first time.- Returns:
- A reference to a DatabaseConnectionSingleton object
-