27 lines
768 B
Java
27 lines
768 B
Java
|
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.");
|
||
|
}
|
||
|
}
|
||
|
}
|