diff --git a/DEV.3.1/TP/TP1/Vote.class b/DEV.3.1/TP/TP1/Vote.class index 258ae8f..f488f90 100644 Binary files a/DEV.3.1/TP/TP1/Vote.class and b/DEV.3.1/TP/TP1/Vote.class differ diff --git a/DEV.3.1/TP/TP1/Vote.java b/DEV.3.1/TP/TP1/Vote.java index a789f81..325868d 100644 --- a/DEV.3.1/TP/TP1/Vote.java +++ b/DEV.3.1/TP/TP1/Vote.java @@ -6,29 +6,38 @@ public class Vote { public Vote(String[] args) { this.pays = pays; - } - - public Vote() { try{ Connection cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/srivasta","srivasta", "Tiamzon2006"); - PreparedStatement pst = cnx.prepareStatement("SELECT * FROM tp1_pays AND tp1_vote;"); + try{ + PreparedStatement req = cnx.prepareStatement("SELECT * FROM tp1_points;"); + ResultSet rs = req.executeQuery(); - - ResultSet rs = pst.executeQuery(); + while(rs.next()) { + System.out.print(rs.getInt(2)+" "); + System.out.print(rs.getString(1)+" "); + System.out.println(rs.getInt(3)); + } - pst.close(); - rs.close(); - cnx.close(); + try{ + rs.close(); + req.close(); + cnx.close(); + + }catch(SQLException e) { + System.err.println("Erreur de connexion : "+e); + } + }catch(SQLException e) { + System.err.println("Erreur SQL ou de connexion : "+e); + } } catch(SQLException e) { System.err.println("Erreur de connexion : "+e); - } } public static void main(String[] args) { - Vote vote = new Vote(); + Vote vote = new Vote(args); } } \ No newline at end of file