add Dev Part
This commit is contained in:
26
DEV/DEV3.1/TP01/Exercise1/Main.java
Normal file
26
DEV/DEV3.1/TP01/Exercise1/Main.java
Normal file
@@ -0,0 +1,26 @@
|
||||
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.");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user