This commit is contained in:
EmmanuelTiamzon
2025-09-16 10:27:52 +02:00
parent 7159f20d83
commit 9e97598341
3 changed files with 15 additions and 7 deletions

BIN
DEV.3.1/TP1/Vote.class Normal file

Binary file not shown.

View File

@@ -2,24 +2,33 @@ import java.sql.*;
public class Vote { public class Vote {
private String pays; private String[] pays;
public Vote(String pays) { public Vote(String[] args) {
this.pays = pays; this.pays = pays;
}
public Vote() {
try{ try{
Connection cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/srivasta","srivasta", "Tiamzon2006"); Connection cnx = DriverManager.getConnection("jdbc:mariadb://dwarves.iut-fbleau.fr/srivasta","srivasta", "Tiamzon2006");
PreparedStatement pst = cnx.prepareStatement("CREATE TABLE Pays (nom_pays varchar(256));"); PreparedStatement pst = cnx.prepareStatement("SELECT * FROM tp1_pays AND tp1_vote;");
pst.executeUpdate();
PreparedStatement pst = cnx.prepareStatement("INSERT INTO Pays VALUES('Pays-Bas','Italie','Russie'");
pst.executeUpdate();
ResultSet rs = pst.executeQuery(); ResultSet rs = pst.executeQuery();
pst.close();
rs.close();
cnx.close();
} catch(SQLException e) { } catch(SQLException e) {
System.err.println("Erreur de connexion : "+e); System.err.println("Erreur de connexion : "+e);
} }
} }
public static void main(String[] args) {
Vote vote = new Vote();
}
} }

View File

@@ -1 +0,0 @@
info/mariadb-client.jar