Files
BUT2/DEV/DEV3.1/TP01/Exercise1/Main.java

27 lines
768 B
Java
Raw Normal View History

2025-09-26 08:56:23 +02:00
import java.sql.ResultSet;
import java.sql.SQLException;
public class Main {
public static void main(String[] args) {
Database database = new Database();
String country = "France";
ResultSet result = database.getVotesFromCompetitor(country);
try {
while(result.next()) {
System.out.println(country + " -> " + result.getString("name") + " : " + result.getInt("points"));
}
} catch(SQLException exception) {
System.err.println("Error while read the data from the result.");
}
try {
result.close();
} catch(SQLException exception) {
System.err.println("Error while trying to close the result.");
}
}
}