From 7159f20d83e39e938e347e7c311a7488e3f7ac19 Mon Sep 17 00:00:00 2001 From: EmmanuelTiamzon Date: Fri, 5 Sep 2025 19:45:08 +0200 Subject: [PATCH] update --- DEV.3.1/TP1/Vote.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/DEV.3.1/TP1/Vote.java b/DEV.3.1/TP1/Vote.java index c25e4b0..28755e2 100644 --- a/DEV.3.1/TP1/Vote.java +++ b/DEV.3.1/TP1/Vote.java @@ -3,7 +3,23 @@ import java.sql.*; public class Vote { private String pays; + public Vote(String pays) { this.pays = pays; + + try{ + Connection cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/srivasta","srivasta", "Tiamzon2006"); + + PreparedStatement pst = cnx.prepareStatement("CREATE TABLE Pays (nom_pays varchar(256));"); + pst.executeUpdate(); + PreparedStatement pst = cnx.prepareStatement("INSERT INTO Pays VALUES('Pays-Bas','Italie','Russie'"); + pst.executeUpdate(); + + ResultSet rs = pst.executeQuery(); + + } catch(SQLException e) { + System.err.println("Erreur de connexion : "+e); + + } } } \ No newline at end of file