Newer
Older
import java.sql.*;
protected Staff staff;
protected Schedule schedule;
private Connection dbConnection;
public Model(){
connectDataBase();
this.staff = new Staff(dbConnection);
this.schedule = new Schedule(dbConnection);
}
protected String connectDataBase(){
try {
dbConnection = DriverManager.getConnection("jdbc:mysql://localhost:3306/ScheduleApp", "root", "password");
} catch (Exception e) {
System.out.println(e.fillInStackTrace());
return "Couldn't connect to database.";
}
return "Successfully connected to database.";
}