Jul 14, 2024
PreparedStatement ps = connection.prepareStatement("SELECT * FROM table");
ResultSet rs = ps.executeQuery();
while (rs.next()) {
// Load each row into an object and add to list
}
FileWriter excel = new FileWriter("output.xlsx");
for (Object obj : arrayOfObjects) {
excel.write(obj.toString());
}
excel.close();