I am trying to gather information from a MySQL database and then exporting that information to a Excel document using POI and JAVA.
The only problem I am experiencing is increasing the number after data.put, each time if(rs.next()) is executed, for example:
Map<String, Object[]> data = new HashMap<>();
data.put("1", new Object[] {"Emp No.", "Name", "Salary"});
if(rs.next()) {
data.put("2", new Object[] {1d, "John", 1500000d, "Test"});
}
The 2 should increase to 3 then to 4 then to 5, depending on the rows in the MySQL database.
Any help is appreciated.