lizocf / ECE-366-Duopoly

4 stars 1 forks source link

Combining jdbc with database #5

Closed lizocf closed 4 months ago

lizocf commented 4 months ago

get connection to database with jdbc

lizocf commented 4 months ago

can't make generic updates such as this:

    @Override
    public void update(AccountUtil dto) { // update_dp
        try(PreparedStatement statement = this.connection.prepareStatement(UPDATE);)
            {
                statement.setString(1,"duo_points"); // theres an issue with calling this :\
                statement.setInt(2, dto.getDuoPoints() + 100); // 100 needs to be changed based on whether they win/lose/rank
                statement.setInt(3, dto.getUserId());
                statement.execute();
            }catch (SQLException e){
                e.printStackTrace();
                throw new RuntimeException(e);
            }
        }

results in this error: image