I'm trying to populate a hashmap with items from a result set. my problems: ResultSet was skipping my first entry, so there are actually 4 items in the table, but its only grabbing 3 while getting the info this way: Code:java while(rs.next()){ String playerName = rs.getString("playerName"); int kills = rs.getInt("kills"); myMap.put(playerName, kills); } so i changed my code to: Code:java do{String playerName = rs.getString("playerName");int kills = rs.getInt("kills"); myMap.put(playerName, kills); } while(rs.next)); ^^the above code is adding all the entries, but im getting SQLException Code: java.sql.SQLException: Before start of result set what is the best way to get ALL my entries from a table using MySQL and adding the items to a hashmap without skipping the first entry?
I don't know if this makes a difference, but change to this: Code:java if(rs.next()){ String playerName = rs.getString("playerName"); int kills = rs.getInt("kills"); myMap.put(playerName, kills); }