|
|
@ -9,6 +9,10 @@ import java.sql.Statement; |
|
|
|
public class Games { |
|
|
|
private String databaseURL = "jdbc:ucanaccess://GamesDB.accdb"; |
|
|
|
|
|
|
|
/** |
|
|
|
* Checks if the connection to the database can be established |
|
|
|
* @return Returns true if it connects successfully and false if the connection fails. |
|
|
|
*/ |
|
|
|
public boolean checkConnection() { |
|
|
|
try { |
|
|
|
Connection connection = DriverManager.getConnection(databaseURL); |
|
|
@ -21,6 +25,10 @@ public class Games { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Prints the whole table for those, who cannot access the Database for some reason. |
|
|
|
* @return Returns a String of the whole table. |
|
|
|
*/ |
|
|
|
public String printTable() { |
|
|
|
String result = ""; |
|
|
|
String query = "SELECT * FROM Games"; |
|
|
|