I am attempting to create a REST application which will work with a HSQLDB. Upon attempting to connect to the DB, i get the following error:
https://i.gyazo.com/341073dc7fea672472f691298373df63.png
The code which the error is pointing to :
public List<Team> getTeams() {
Connection connection = getConnection();
List<Team> TeamsList = new ArrayList<Team>();
try
{
PreparedStatement psmt = connection.prepareStatement("SELECT * FROM TEAMS");
ResultSet rs = psmt.executeQuery();
while (rs.next())
{
int id = rs.getInt("id");
String league = rs.getString("league");
String name = rs.getString("name");
String manager = rs.getString("manager");
Team team = new Team(id, league, name, manager);
TeamsList.add(team);
}
} catch (SQLException e){
e.printStackTrace();
}
return TeamsList;
}
Line 74 is PreparedStatement psmt = connection.prepareStatement("SELECT * FROM TEAMS");
When I attempt to execute the HSQL statement from Java it returns null, but when i do it directly to the database (outside of Java) it returns the tables requested.